public static ResultSignal Dispatch(ISkyApplication app, PID pid, string description = null) { var finish = MakeNew <FinishSignal>(app, pid); finish.Description = description; return(app.ProcessManager.Dispatch(finish)); }
private static TTodo makeDefault <TTodo>(ISkyApplication app, TTodo todo) where TTodo : Todo { app.DependencyInjector.InjectInto(todo); //warning: Todo IDs must be cross-type unique (should not depend on queue) todo.m_SysID = app.GdidProvider.GenerateOneGdid(SysConsts.GDID_NS_WORKER, SysConsts.GDID_NAME_WORKER_TODO); todo.m_SysCreateTimestampUTC = app.TimeSource.UTCNow; return(todo); }
private static TSignal makeDefault <TSignal>(ISkyApplication app, TSignal signal, PID pid) where TSignal : Signal { app.DependencyInjector.InjectInto(signal); signal.m_SysID = app.GdidProvider.GenerateOneGdid(SysConsts.GDID_NS_WORKER, SysConsts.GDID_NAME_WORKER_SIGNAL); signal.m_SysPID = pid; signal.m_SysTimestampUTC = app.TimeSource.UTCNow; signal.m_SysAbout = "{0}@{1}@{2}".Args(Ambient.CurrentCallUser.Name, app.Name, app.HostName); return(signal); }
/// <summary> /// Opens metabase from the specified file system instance at the specified metabase root path /// </summary> /// <param name="bootApplication">IApplication chassis which this metabank boots from</param> /// <param name="skyApplication">ISkyApplication chassis which this metabank installs in</param> /// <param name="fileSystem"> /// An instance of a file system that stores the metabase files /// Note: This file system is typically a component of Boot application, not the sky app which is being mounted. /// Metabank does NOT dispose the FS, as it is an external resource relative to metabank /// </param> /// <param name="fsSessionParams">File system connection parameter</param> /// <param name="rootPath">A path to the directory within the file system that contains metabase root data</param> internal Metabank(IApplication bootApplication, ISkyApplication skyApplication, IFileSystem fileSystem, FileSystemSessionConnectParams fsSessionParams, string rootPath) : base(bootApplication.NonNull(nameof(bootApplication))) { this.m_SkyApplication = skyApplication.NonNull(nameof(skyApplication)); if (fileSystem is LocalFileSystem && fsSessionParams == null) { fsSessionParams = new FileSystemSessionConnectParams(); } if (fileSystem == null || fsSessionParams == null) { throw new MetabaseException(StringConsts.ARGUMENT_ERROR + "Metabank.ctor(fileSystem|fsSessionParams==null)"); } using (var session = ctorFS(fileSystem, fsSessionParams, rootPath)) { m_CommonLevelConfig = getConfigFromFile(session, CONFIG_COMMON_FILE).Root; m_RootConfig = getConfigFromFile(session, CONFIG_SECTION_LEVEL_FILE).Root; includeCommonConfig(m_RootConfig); m_RootConfig.ResetModified(); m_RootAppConfig = getConfigFromFile(session, CONFIG_SECTION_LEVEL_ANY_APP_FILE).Root; m_PlatformConfig = getConfigFromFile(session, CONFIG_PLATFORMS_FILE).Root; m_NetworkConfig = getConfigFromFile(session, CONFIG_NETWORKS_FILE).Root; m_ContractConfig = getConfigFromFile(session, CONFIG_CONTRACTS_FILE).Root; } m_Catalogs = new Registry <Catalog>(); var cacheStore = new CacheStore(this, "AC.Metabank"); //No app available - nowhere to configure: //cacheStore.Configure(null); /* * cacheStore.TableOptions.Register( new TableOptions(APP_CATALOG, 37, 3) ); * cacheStore.TableOptions.Register( new TableOptions(BIN_CATALOG, 37, 7) ); * cacheStore.TableOptions.Register( new TableOptions(REG_CATALOG, 37, 17) ); * superseded by the cacheStore.DefaultTableOptions below: */ cacheStore.DefaultTableOptions = new TableOptions("*", 37, 17); //reg catalog needs more space cacheStore.TableOptions.Register(new TableOptions(REG_CATALOG, 571, 37)); cacheStore.InstrumentationEnabled = false; m_Cache = new ComplexKeyHashingStrategy(cacheStore); new AppCatalog(this); new BinCatalog(this); new SecCatalog(this); new RegCatalog(this); ConfigAttribute.Apply(this, m_RootConfig); }
internal BootConfLoader(ISkyApplication application, IApplication bootApplication, SystemApplicationType appType, IFileSystem metabaseFileSystem, FileSystemSessionConnectParams metabaseFileSystemSessionParams, string metabaseFileSystemRootPath, string thisHostName, string[] cmdArgs, ConfigSectionNode rootConfig, string dynamicHostNameSuffix = null) { Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture(); SystemVarResolver.Bind();//todo: Refactor to use ~App. app var resolver instead Configuration.ProcesswideConfigNodeProviderType = typeof(MetabankFileConfigNodeProvider); m_SystemApplicationType = appType; m_Application = application.NonNull(nameof(application)); //1. Init boot app container m_BootApplication = bootApplication; if (m_BootApplication == null) { m_BootApplication = new AzosApplication(allowNesting: true, cmdArgs: cmdArgs, rootConfig: rootConfig); m_IsBootApplicationOwner = true; } writeLog(MessageType.Trace, "Entering Sky app bootloader..."); //2. what host is this? m_HostName = determineHostName(thisHostName); //Sets cluster host name in all log messages if (m_HostName.IsNotNullOrWhiteSpace()) { Message.DefaultHostName = m_HostName; } //3. Mount metabank var mNode = m_BootApplication.ConfigRoot[CONFIG_SKY_SECTION][CONFIG_METABASE_SECTION]; ensureMetabaseAppName(mNode); m_Metabase = new Metabank(m_BootApplication, m_Application, metabaseFileSystem, metabaseFileSystemSessionParams, metabaseFileSystemRootPath); m_IsMetabaseFSOwner = false;//externally supplied writeLog(MessageType.Trace, "...exiting Sky app bootloader"); }
private static TProcess makeDefault <TProcess>(ISkyApplication app, TProcess process, PID pid) where TProcess : Process { app.DependencyInjector.InjectInto(process); var attr = GuidTypeAttribute.GetGuidTypeAttribute <Process, ProcessAttribute>(process.GetType()); var descriptor = new ProcessDescriptor( pid, attr.Description, app.TimeSource.UTCNow, "{0}@{1}@{2}".Args(Ambient.CurrentCallUser.Name, app.Name, app.HostName)); process.m_SysDescriptor = descriptor; return(process); }
/// <summary> /// If there is menu configured, returns it, or empty string. /// Path isoLang iso code for localized descriptions, or null for english /// Menu structure /// item /// { /// text="american english text" text_fr="french text" text_deu="german text" href="/item path" /// item{...} /// } /// </summary> public static string BuildMenu(ISkyApplication app, string isoLang) { var menu = app.ConfigRoot[SkyApplication.CONFIG_WEB_MANAGER_SECTION][CONFIG_MENU_SECTION]; if (!menu.Exists) { return(string.Empty); } var result = new StringBuilder(); result.AppendLine("<ul>"); buildMenuLevel(isoLang, result, menu); result.AppendLine("</ul>"); return(result.ToString()); }
internal BootConfLoader(ISkyApplication application, IApplication bootApplication, SystemApplicationType appType, string [] cmdArgs, ConfigSectionNode rootConfig) { Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture(); SystemVarResolver.Bind();//todo: Refactor to use ~App. app var resolver instead Configuration.ProcesswideConfigNodeProviderType = typeof(MetabankFileConfigNodeProvider); m_SystemApplicationType = appType; m_Application = application.NonNull(nameof(application)); //1. Init boot app container m_BootApplication = bootApplication; if (m_BootApplication == null) { m_BootApplication = new AzosApplication(allowNesting: true, cmdArgs: cmdArgs, rootConfig: rootConfig); m_IsBootApplicationOwner = true; } writeLog(MessageType.Trace, "Entering Sky app bootloader..."); //2. what host is this? m_HostName = determineHostName(null); //Sets cluster host name in all log messages if (m_HostName.IsNotNullOrWhiteSpace()) { Message.DefaultHostName = m_HostName; } //3. Mount Metabank m_Metabase = mountMetabank(); writeLog(MessageType.Trace, "...exiting Sky app bootloader"); }
public static ResultSignal Dispatch(ISkyApplication app, PID pid) { var finalize = MakeNew <FinalizeSignal>(app, pid); return(app.ProcessManager.Dispatch(finalize)); }
public HostManager(ISkyApplication director) : base(director) { }