internal Dispatcher( OrleansTaskScheduler scheduler, MessageCenter transport, Catalog catalog, IOptionsMonitor <SiloMessagingOptions> messagingOptions, PlacementService placementService, ILocalGrainDirectory localGrainDirectory, GrainLocator grainLocator, ActivationCollector activationCollector, MessageFactory messageFactory, CompatibilityDirectorManager compatibilityDirectorManager, ILoggerFactory loggerFactory, RuntimeMessagingTrace messagingTrace, GrainVersionManifest versionManifest, IAsyncTimerFactory asyncTimerFactory, IncomingRequestMonitor incomingRequestMonitor) { _activationWorkloadMonitor = incomingRequestMonitor; this.scheduler = scheduler; this.catalog = catalog; Transport = transport; this.messagingOptions = messagingOptions.CurrentValue; this.invokeWorkItemLogger = loggerFactory.CreateLogger <InvokeWorkItem>(); this.placementService = placementService; this.localGrainDirectory = localGrainDirectory; this.grainLocator = grainLocator; this.activationCollector = activationCollector; this.messageFactory = messageFactory; this.compatibilityDirectorManager = compatibilityDirectorManager; this.messagingTrace = messagingTrace; this._versionManifest = versionManifest; logger = loggerFactory.CreateLogger <Dispatcher>(); }
internal Dispatcher( OrleansTaskScheduler scheduler, MessageCenter transport, Catalog catalog, IOptions <SiloMessagingOptions> messagingOptions, PlacementService placementService, ILocalGrainDirectory localGrainDirectory, GrainLocator grainLocator, ActivationCollector activationCollector, MessageFactory messageFactory, CompatibilityDirectorManager compatibilityDirectorManager, ILoggerFactory loggerFactory, IOptions <SchedulingOptions> schedulerOptions, RuntimeMessagingTrace messagingTrace, GrainTypeManager grainTypeManager) { this.scheduler = scheduler; this.catalog = catalog; Transport = transport; this.messagingOptions = messagingOptions.Value; this.invokeWorkItemLogger = loggerFactory.CreateLogger <InvokeWorkItem>(); this.placementService = placementService; this.localGrainDirectory = localGrainDirectory; this.grainLocator = grainLocator; this.activationCollector = activationCollector; this.messageFactory = messageFactory; this.compatibilityDirectorManager = compatibilityDirectorManager; this.messagingTrace = messagingTrace; this.grainTypeManager = grainTypeManager; this.schedulingOptions = schedulerOptions.Value; logger = loggerFactory.CreateLogger <Dispatcher>(); }
/// <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); } }
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 GrainLocatorTests(ITestOutputHelper output) { this.loggerFactory = new LoggerFactory(new[] { new XunitLoggerProvider(output) }); this.lifecycle = new SiloLifecycleSubject(this.loggerFactory.CreateLogger <SiloLifecycleSubject>()); this.grainDirectory = Substitute.For <IGrainDirectory>(); this.localGrainDirectory = Substitute.For <ILocalGrainDirectory>(); this.mockMembershipService = new MockClusterMembershipService(); this.grainLocator = new GrainLocator( this.grainDirectory, new DhtGrainLocator(this.localGrainDirectory), this.mockMembershipService.Target); this.grainLocator.Participate(this.lifecycle); }
public ManagementGrain( IInternalGrainFactory internalGrainFactory, ISiloStatusOracle siloStatusOracle, IVersionStore versionStore, ILogger <ManagementGrain> logger, MembershipTableManager membershipTableManager, IClusterManifestProvider clusterManifestProvider, Catalog catalog, GrainLocator grainLocator) { this.membershipTableManager = membershipTableManager; this.siloManifest = clusterManifestProvider.LocalGrainManifest; this.clusterManifest = clusterManifestProvider.Current; this.internalGrainFactory = internalGrainFactory; this.siloStatusOracle = siloStatusOracle; this.versionStore = versionStore; this.logger = logger; this.catalog = catalog; this.grainLocator = grainLocator; }
public InternalGrainRuntime( MessageCenter messageCenter, Catalog catalog, GrainVersionManifest versionManifest, RuntimeMessagingTrace messagingTrace, GrainLocator grainLocator, CompatibilityDirectorManager compatibilityDirectorManager, IOptions <GrainCollectionOptions> collectionOptions, ILocalGrainDirectory localGrainDirectory, IActivationWorkingSet activationWorkingSet) { MessageCenter = messageCenter; Catalog = catalog; RuntimeClient = catalog.RuntimeClient; GrainVersionManifest = versionManifest; MessagingTrace = messagingTrace; CompatibilityDirectorManager = compatibilityDirectorManager; GrainLocator = grainLocator; CollectionOptions = collectionOptions; LocalGrainDirectory = localGrainDirectory; ActivationWorkingSet = activationWorkingSet; }
static async ValueTask <SiloAddress> LookupAsync(GrainId grainId, GrainLocator grainLocator) { var result = await grainLocator.Lookup(grainId); return(result?.Silo); }
public OneWayGrain(GrainLocator grainLocator) => this.grainLocator = grainLocator;