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

     1  /*
     2   * Copyright (c) 2022-present unTill Pro, Ltd.
     3   */
     4  
     5  package registryapp
     6  
     7  import (
     8  	"github.com/voedger/voedger/pkg/appparts"
     9  	"github.com/voedger/voedger/pkg/apps"
    10  	"github.com/voedger/voedger/pkg/extensionpoints"
    11  	"github.com/voedger/voedger/pkg/istructs"
    12  	"github.com/voedger/voedger/pkg/istructsmem"
    13  	"github.com/voedger/voedger/pkg/parser"
    14  	"github.com/voedger/voedger/pkg/registry"
    15  	"github.com/voedger/voedger/pkg/sys"
    16  	"github.com/voedger/voedger/pkg/sys/smtp"
    17  )
    18  
    19  // for historical reason num partitions of sys/registry must be equal to numCP
    20  func Provide(smtpCfg smtp.Cfg, numCP istructs.NumCommandProcessors) apps.AppBuilder {
    21  	return func(apis apps.APIs, cfg *istructsmem.AppConfigType, ep extensionpoints.IExtensionPoint) apps.BuiltInAppDef {
    22  
    23  		// sys package
    24  		sysPackageFS := sys.Provide(cfg, smtpCfg, ep, nil, apis.TimeFunc, apis.ITokens, apis.IFederation, apis.IAppStructsProvider, apis.IAppTokensFactory,
    25  			nil, apis.IAppStorageProvider)
    26  
    27  		// sys/registry resources
    28  		registryPackageFS := registry.Provide(cfg, apis.IAppStructsProvider, apis.ITokens, apis.IFederation)
    29  		cfg.AddSyncProjectors(registry.ProvideSyncProjectorLoginIdx())
    30  		registryAppPackageFS := parser.PackageFS{
    31  			Path: RegistryAppFQN,
    32  			FS:   registryAppSchemaFS,
    33  		}
    34  
    35  		return apps.BuiltInAppDef{
    36  			AppQName: istructs.AppQName_sys_registry,
    37  			Packages: []parser.PackageFS{sysPackageFS, registryPackageFS, registryAppPackageFS},
    38  			AppDeploymentDescriptor: appparts.AppDeploymentDescriptor{
    39  				NumParts:         istructs.NumAppPartitions(numCP),
    40  				EnginePoolSize:   appparts.PoolSize(int(numCP), DefDeploymentQPCount, int(numCP)),
    41  				NumAppWorkspaces: istructs.DefaultNumAppWorkspaces,
    42  			},
    43  		}
    44  	}
    45  }