Esempio n. 1
0
        public SiloControl(
            ILocalSiloDetails localSiloDetails,
            DeploymentLoadPublisher deploymentLoadPublisher,
            Catalog catalog,
            GrainTypeManager grainTypeManager,
            ISiloPerformanceMetrics siloMetrics,
            CachedVersionSelectorManager cachedVersionSelectorManager,
            CompatibilityDirectorManager compatibilityDirectorManager,
            VersionSelectorManager selectorManager,
            IServiceProvider services,
            ILoggerFactory loggerFactory)
            : base(Constants.SiloControlId, localSiloDetails.SiloAddress, loggerFactory)
        {
            this.localSiloDetails = localSiloDetails;

            this.logger = loggerFactory.CreateLogger <SiloControl>();
            this.deploymentLoadPublisher = deploymentLoadPublisher;
            this.catalog                      = catalog;
            this.grainTypeManager             = grainTypeManager;
            this.siloMetrics                  = siloMetrics;
            this.cachedVersionSelectorManager = cachedVersionSelectorManager;
            this.compatibilityDirectorManager = compatibilityDirectorManager;
            this.selectorManager              = selectorManager;
            this.controllables                = new Dictionary <Tuple <string, string>, IControllable>();
            IEnumerable <IKeyedServiceCollection <string, IControllable> > namedIControllableCollections = services.GetServices <IKeyedServiceCollection <string, IControllable> >();

            foreach (IKeyedService <string, IControllable> keyedService in namedIControllableCollections.SelectMany(c => c.GetServices(services)))
            {
                IControllable controllable = keyedService.GetService(services);
                if (controllable != null)
                {
                    this.controllables.Add(Tuple.Create(controllable.GetType().FullName, keyedService.Key), controllable);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Create a <see cref="PlacementService"/> instance.
 /// </summary>
 public PlacementService(
     IOptionsMonitor <SiloMessagingOptions> siloMessagingOptions,
     ILocalSiloDetails localSiloDetails,
     ISiloStatusOracle siloStatusOracle,
     ILogger <PlacementService> logger,
     GrainLocator grainLocator,
     GrainVersionManifest grainInterfaceVersions,
     CachedVersionSelectorManager versionSelectorManager,
     PlacementDirectorResolver directorResolver,
     PlacementStrategyResolver strategyResolver)
 {
     LocalSilo                         = localSiloDetails.SiloAddress;
     _strategyResolver                 = strategyResolver;
     _directorResolver                 = directorResolver;
     _logger                           = logger;
     _grainLocator                     = grainLocator;
     _grainInterfaceVersions           = grainInterfaceVersions;
     _versionSelectorManager           = versionSelectorManager;
     _siloStatusOracle                 = siloStatusOracle;
     _assumeHomogeneousSilosForTesting = siloMessagingOptions.CurrentValue.AssumeHomogenousSilosForTesting;
     _workers                          = new PlacementWorker[PlacementWorkerCount];
     for (var i = 0; i < PlacementWorkerCount; i++)
     {
         _workers[i] = new(this);
     }
 }
Esempio n. 3
0
        public SiloControl(
            ILocalSiloDetails localSiloDetails,
            Factory <NodeConfiguration> localConfiguration,
            ClusterConfiguration clusterConfiguration,
            DeploymentLoadPublisher deploymentLoadPublisher,
            Catalog catalog,
            GrainTypeManager grainTypeManager,
            ISiloPerformanceMetrics siloMetrics,
            IEnumerable <IProviderManager> providerManagers,
            ProviderManagerSystemTarget providerManagerSystemTarget,
            CachedVersionSelectorManager cachedVersionSelectorManager,
            CompatibilityDirectorManager compatibilityDirectorManager,
            VersionSelectorManager selectorManager,
            ILoggerFactory loggerFactory)
            : base(Constants.SiloControlId, localSiloDetails.SiloAddress, loggerFactory)
        {
            this.localSiloDetails     = localSiloDetails;
            this.localConfiguration   = localConfiguration;
            this.clusterConfiguration = clusterConfiguration;

            this.logger = loggerFactory.CreateLogger <SiloControl>();
            this.deploymentLoadPublisher = deploymentLoadPublisher;
            this.catalog                      = catalog;
            this.grainTypeManager             = grainTypeManager;
            this.siloMetrics                  = siloMetrics;
            this.providerManagerSystemTarget  = providerManagerSystemTarget;
            this.providerManagers             = providerManagers.ToList();
            this.cachedVersionSelectorManager = cachedVersionSelectorManager;
            this.compatibilityDirectorManager = compatibilityDirectorManager;
            this.selectorManager              = selectorManager;
        }
Esempio n. 4
0
        public SiloControl(
            ILocalSiloDetails localSiloDetails,
            DeploymentLoadPublisher deploymentLoadPublisher,
            Catalog catalog,
            CachedVersionSelectorManager cachedVersionSelectorManager,
            CompatibilityDirectorManager compatibilityDirectorManager,
            VersionSelectorManager selectorManager,
            IServiceProvider services,
            ILoggerFactory loggerFactory,
            IMessageCenter messageCenter,
            ActivationCollector activationCollector,
            ActivationDirectory activationDirectory,
            IActivationWorkingSet activationWorkingSet,
            IAppEnvironmentStatistics appEnvironmentStatistics,
            IHostEnvironmentStatistics hostEnvironmentStatistics,
            IOptions <LoadSheddingOptions> loadSheddingOptions,
            GrainCountStatistics grainCountStatistics)
            : base(Constants.SiloControlType, localSiloDetails.SiloAddress, loggerFactory)
        {
            this.localSiloDetails = localSiloDetails;

            this.logger = loggerFactory.CreateLogger <SiloControl>();
            this.deploymentLoadPublisher = deploymentLoadPublisher;
            this.catalog = catalog;
            this.cachedVersionSelectorManager = cachedVersionSelectorManager;
            this.compatibilityDirectorManager = compatibilityDirectorManager;
            this.selectorManager           = selectorManager;
            _activationCollector           = activationCollector;
            this.activationDirectory       = activationDirectory;
            this.activationWorkingSet      = activationWorkingSet;
            this.appEnvironmentStatistics  = appEnvironmentStatistics;
            this.hostEnvironmentStatistics = hostEnvironmentStatistics;
            this.loadSheddingOptions       = loadSheddingOptions;
            _grainCountStatistics          = grainCountStatistics;
            this.controllables             = new Dictionary <Tuple <string, string>, IControllable>();
            IEnumerable <IKeyedServiceCollection <string, IControllable> > namedIControllableCollections = services.GetServices <IKeyedServiceCollection <string, IControllable> >();

            foreach (IKeyedService <string, IControllable> keyedService in namedIControllableCollections.SelectMany(c => c.GetServices(services)))
            {
                IControllable controllable = keyedService.GetService(services);
                if (controllable != null)
                {
                    this.controllables.Add(Tuple.Create(controllable.GetType().FullName, keyedService.Key), controllable);
                }
            }
        }
Esempio n. 5
0
 internal TypeManager(
     SiloAddress myAddr,
     GrainTypeManager grainTypeManager,
     ISiloStatusOracle oracle,
     OrleansTaskScheduler scheduler,
     TimeSpan refreshClusterMapInterval,
     ImplicitStreamSubscriberTable implicitStreamSubscriberTable,
     IInternalGrainFactory grainFactory,
     CachedVersionSelectorManager versionSelectorManager,
     ILoggerFactory loggerFactory)
     : base(Constants.TypeManagerId, myAddr, loggerFactory)
 {
     if (grainTypeManager == null)
     {
         throw new ArgumentNullException(nameof(grainTypeManager));
     }
     if (oracle == null)
     {
         throw new ArgumentNullException(nameof(oracle));
     }
     if (scheduler == null)
     {
         throw new ArgumentNullException(nameof(scheduler));
     }
     if (implicitStreamSubscriberTable == null)
     {
         throw new ArgumentNullException(nameof(implicitStreamSubscriberTable));
     }
     this.logger           = loggerFactory.CreateLogger <TypeManager>();
     this.grainTypeManager = grainTypeManager;
     this.statusOracle     = oracle;
     this.implicitStreamSubscriberTable = implicitStreamSubscriberTable;
     this.grainFactory           = grainFactory;
     this.versionSelectorManager = versionSelectorManager;
     this.scheduler = scheduler;
     this.refreshClusterMapInterval = refreshClusterMapInterval;
     // We need this so we can place needed local activations
     this.grainTypeManager.SetInterfaceMapsBySilo(new Dictionary <SiloAddress, GrainInterfaceMap>
     {
         { this.Silo, grainTypeManager.GetTypeCodeMap() }
     });
 }
Esempio n. 6
0
 public SiloControl(
     Silo silo,
     DeploymentLoadPublisher deploymentLoadPublisher,
     Catalog catalog,
     GrainTypeManager grainTypeManager,
     ISiloPerformanceMetrics siloMetrics,
     CachedVersionSelectorManager cachedVersionSelectorManager,
     CompatibilityDirectorManager compatibilityDirectorManager,
     VersionSelectorManager selectorManager)
     : base(Constants.SiloControlId, silo.SiloAddress)
 {
     this.silo = silo;
     this.deploymentLoadPublisher = deploymentLoadPublisher;
     this.catalog                      = catalog;
     this.grainTypeManager             = grainTypeManager;
     this.siloMetrics                  = siloMetrics;
     this.cachedVersionSelectorManager = cachedVersionSelectorManager;
     this.compatibilityDirectorManager = compatibilityDirectorManager;
     this.selectorManager              = selectorManager;
 }
Esempio n. 7
0
        internal TypeManager(
            SiloAddress myAddr,
            GrainTypeManager grainTypeManager,
            ISiloStatusOracle oracle,
            OrleansTaskScheduler scheduler,
            TimeSpan refreshClusterMapTimeout,
            ImplicitStreamSubscriberTable implicitStreamSubscriberTable,
            IInternalGrainFactory grainFactory,
            CachedVersionSelectorManager versionSelectorManager)
            : base(Constants.TypeManagerId, myAddr)
        {
            if (grainTypeManager == null)
            {
                throw new ArgumentNullException(nameof(grainTypeManager));
            }
            if (oracle == null)
            {
                throw new ArgumentNullException(nameof(oracle));
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (implicitStreamSubscriberTable == null)
            {
                throw new ArgumentNullException(nameof(implicitStreamSubscriberTable));
            }

            this.grainTypeManager = grainTypeManager;
            this.statusOracle     = oracle;
            this.implicitStreamSubscriberTable = implicitStreamSubscriberTable;
            this.grainFactory           = grainFactory;
            this.versionSelectorManager = versionSelectorManager;
            this.scheduler = scheduler;
            this.hasToRefreshClusterGrainInterfaceMap = true;
            this.refreshClusterGrainInterfaceMapTimer = new AsyncTaskSafeTimer(
                OnRefreshClusterMapTimer,
                null,
                TimeSpan.Zero,      // Force to do it once right now
                refreshClusterMapTimeout);
        }
Esempio n. 8
0
        internal TypeManager(
            SiloAddress myAddr,
            GrainTypeManager grainTypeManager,
            ISiloStatusOracle oracle,
            OrleansTaskScheduler scheduler,
            TimeSpan refreshClusterMapTimeout,
            ImplicitStreamSubscriberTable implicitStreamSubscriberTable,
            IInternalGrainFactory grainFactory,
            CachedVersionSelectorManager versionSelectorManager)
            : base(Constants.TypeManagerId, myAddr)
        {
            if (grainTypeManager == null)
            {
                throw new ArgumentNullException(nameof(grainTypeManager));
            }
            if (oracle == null)
            {
                throw new ArgumentNullException(nameof(oracle));
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (implicitStreamSubscriberTable == null)
            {
                throw new ArgumentNullException(nameof(implicitStreamSubscriberTable));
            }

            this.grainTypeManager = grainTypeManager;
            this.statusOracle     = oracle;
            this.implicitStreamSubscriberTable = implicitStreamSubscriberTable;
            this.grainFactory           = grainFactory;
            this.versionSelectorManager = versionSelectorManager;
            this.scheduler = scheduler;
            this.refreshClusterMapTimeout = refreshClusterMapTimeout;
        }