コード例 #1
0
        private static DeploymentServerState CreateState(IActorRefFactory context, ISharpRepositoryConfiguration configuration, IDirectory fileSystem, DataTransferManager manager,
                                                         RepositoryApi repositoryApi)
        {
            var changeTracker = context.ActorOf("Change-Tracker", ChangeTrackerActor.New());

            var trashBin = configuration.GetInstance <ToDeleteRevision, string>(CleanUpManager.RepositoryKey);

            var cleanUp = context.ActorOf("CleanUp-Manager", CleanUpManager.New(configuration, fileSystem));

            cleanUp.Tell(CleanUpManager.Initialization);

            var router = new SmallestMailboxPool(Environment.ProcessorCount)
                         .WithSupervisorStrategy(SupervisorStrategy.DefaultStrategy);

            var queryProps = Feature.Props(AppQueryHandler.New(configuration.GetInstance <AppData, string>(), fileSystem, manager, changeTracker))
                             .WithRouter(router);
            var query = context.ActorOf(queryProps, "QueryRouter");

            var buildSystem = WorkDistributorFeature <BuildRequest, BuildCompled>
                              .Create(context, Props.Create(() => new BuildingActor(manager)), "Compiler", TimeSpan.FromHours(1), "CompilerSupervisor");

            var processorProps = Feature.Props(AppCommandProcessor.New(configuration.GetInstance <AppData, string>(), fileSystem, repositoryApi, manager, trashBin, buildSystem, changeTracker))
                                 .WithRouter(router);
            var processor = context.ActorOf(processorProps, "ProcessorRouter");

            return(new DeploymentServerState(query, processor));
        }
コード例 #2
0
        public static Props New(ISharpRepositoryConfiguration repository)
        {
            var serverConfiguration = repository.GetInstance <ServerConfigurationEntity, string>(ServiceManagerDeamon.RepositoryKey);
            var publisher           = new Subject <IConfigEvent>();

            ConfigFeatureConfiguration CreateState()
            => new(serverConfiguration.Get(ServerConfigurationId)?.Configugration ?? new ServerConfigugration(true, false, string.Empty),
                   repository.GetInstance <GlobalConfigEntity, string>(ServiceManagerDeamon.RepositoryKey),
                   repository.GetInstance <SeedUrlEntity, string>(ServiceManagerDeamon.RepositoryKey),
                   repository.GetInstance <SpecificConfigEntity, string>(ServiceManagerDeamon.RepositoryKey),
                   publisher.ObserveOn(Scheduler.Default),
                   publisher.AsObserver().OnNext);

            return(Feature.Props(Feature.Create(() => new ConfigurationManagerActor(), _ => new State(CreateState, serverConfiguration, publisher)), TellAliveFeature.New()));
        }
コード例 #3
0
        public static IRepository <T, TKey> GetInstance <T, TKey>(ISharpRepositoryConfiguration configuration, string repositoryName = null) where T : class, new()
        {
            if (String.IsNullOrEmpty(repositoryName))
            {
                // if no specific repository is provided then check to see if the SharpRepositoryConfigurationAttribute is used
                repositoryName = GetAttributeRepositoryName(typeof(T));
            }

            return(configuration.GetInstance <T, TKey>(repositoryName));
        }