github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/appparts/provide.go (about)

     1  /*
     2   * Copyright (c) 2021-present Sigma-Soft, Ltd.
     3   * @author: Nikolay Nikitin
     4   */
     5  
     6  package appparts
     7  
     8  import (
     9  	"github.com/voedger/voedger/pkg/appdef"
    10  	"github.com/voedger/voedger/pkg/iextengine"
    11  	"github.com/voedger/voedger/pkg/istructs"
    12  	"github.com/voedger/voedger/pkg/pipeline"
    13  )
    14  
    15  type SyncActualizerFactory = func(istructs.IAppStructs, istructs.PartitionID) pipeline.ISyncOperator
    16  
    17  // New only for tests where sync actualizer is not used
    18  func New(structs istructs.IAppStructsProvider) (ap IAppPartitions, cleanup func(), err error) {
    19  	return NewWithActualizerWithExtEnginesFactories(
    20  		structs,
    21  		func(istructs.IAppStructs, istructs.PartitionID) pipeline.ISyncOperator {
    22  			return &pipeline.NOOP{}
    23  		},
    24  		iextengine.ExtensionEngineFactories{
    25  			appdef.ExtensionEngineKind_BuiltIn: iextengine.NullExtensionEngineFactory,
    26  			appdef.ExtensionEngineKind_WASM:    iextengine.NullExtensionEngineFactory,
    27  		},
    28  	)
    29  }
    30  
    31  func NewWithActualizerWithExtEnginesFactories(structs istructs.IAppStructsProvider, actualizer SyncActualizerFactory,
    32  	eef iextengine.ExtensionEngineFactories) (ap IAppPartitions, cleanup func(), err error) {
    33  	return newAppPartitions(structs, actualizer, eef)
    34  }