/// <summary> /// Initializes a new instance of the <see cref="GrainContextActivator"/> class. /// </summary> /// <param name="providers">The grain context activator providers.</param> /// <param name="configureContextActions">The <see cref="IConfigureGrainContext"/> providers.</param> /// <param name="grainPropertiesResolver">The grain properties resolver.</param> public GrainContextActivator( IEnumerable <IGrainContextActivatorProvider> providers, IEnumerable <IConfigureGrainContextProvider> configureContextActions, GrainPropertiesResolver grainPropertiesResolver) { _resolver = grainPropertiesResolver; _activatorProviders = providers.ToArray(); _configuratorProviders = configureContextActions.ToArray(); }
/// <summary> /// Create a <see cref="PlacementStrategyResolver"/> instance. /// </summary> public PlacementStrategyResolver( IServiceProvider services, IEnumerable <IPlacementStrategyResolver> resolvers, GrainPropertiesResolver grainPropertiesResolver) { _getStrategyInternal = GetPlacementStrategyInternal; _resolvers = resolvers.ToArray(); _services = services; _grainPropertiesResolver = grainPropertiesResolver; _defaultPlacementStrategy = services.GetService <PlacementStrategy>(); _strategies = GetAllStrategies(services);
public Catalog( ILocalSiloDetails localSiloDetails, GrainLocator grainLocator, GrainDirectoryResolver grainDirectoryResolver, ILocalGrainDirectory grainDirectory, ActivationDirectory activationDirectory, ActivationCollector activationCollector, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, IOptions <GrainCollectionOptions> collectionOptions, RuntimeMessagingTrace messagingTrace, GrainContextActivator grainActivator, GrainPropertiesResolver grainPropertiesResolver) : base(Constants.CatalogType, localSiloDetails.SiloAddress, loggerFactory) { this.LocalSilo = localSiloDetails.SiloAddress; this.localSiloName = localSiloDetails.Name; this.grainLocator = grainLocator; this.grainDirectoryResolver = grainDirectoryResolver; this.directory = grainDirectory; this.activations = activationDirectory; this.serviceProvider = serviceProvider; this.collectionOptions = collectionOptions; this.grainActivator = grainActivator; this.grainPropertiesResolver = grainPropertiesResolver; this.logger = loggerFactory.CreateLogger <Catalog>(); this.activationCollector = activationCollector; this.RuntimeClient = serviceProvider.GetRequiredService <InsideRuntimeClient>(); GC.GetTotalMemory(true); // need to call once w/true to ensure false returns OK value IntValueStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_COUNT, () => activations.Count); activationsCreated = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_CREATED); activationsDestroyed = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_DESTROYED); IntValueStatistic.FindOrCreate(StatisticNames.MESSAGING_PROCESSING_ACTIVATION_DATA_ALL, () => { long counter = 0; lock (activations) { foreach (var activation in activations) { if (activation.Value is ActivationData data) { counter += data.GetRequestCount(); } } } return(counter); }); grainDirectory.SetSiloRemovedCatalogCallback(this.OnSiloStatusChange); RegisterSystemTarget(this); }
public GrainDirectoryResolver( IServiceProvider serviceProvider, GrainPropertiesResolver grainPropertiesResolver, IEnumerable <IGrainDirectoryResolver> resolvers) { this.getGrainDirectoryInternal = GetGrainDirectoryPerType; this.resolvers = resolvers.ToArray(); // Load all registered directories var services = serviceProvider.GetService <IKeyedServiceCollection <string, IGrainDirectory> >()?.GetServices(serviceProvider) ?? Enumerable.Empty <IKeyedService <string, IGrainDirectory> >(); foreach (var svc in services) { this.directoryPerName.Add(svc.Key, svc.GetService(serviceProvider)); } this.directoryPerName.TryGetValue(GrainDirectoryAttribute.DEFAULT_GRAIN_DIRECTORY, out var defaultDirectory); this.DefaultGrainDirectory = defaultDirectory; this.grainPropertiesResolver = grainPropertiesResolver; }
public SiloLoggingHelper(GrainPropertiesResolver grainPropertiesResolver, IApplicationPartManager applicationPartManager) : base(grainPropertiesResolver, applicationPartManager) { }
public GrainTypeComponentsResolver(IEnumerable <IConfigureGrainTypeComponents> configurators, GrainPropertiesResolver resolver) { _configurators = configurators.ToArray(); _resolver = resolver; _createFunc = this.Create; }