public SiloProviderRuntime( ILocalSiloDetails siloDetails, IOptions <ClusterOptions> clusterOptions, IConsistentRingProvider consistentRingProvider, ISiloRuntimeClient runtimeClient, ImplicitStreamSubscriberTable implicitStreamSubscriberTable, ISiloStatusOracle siloStatusOracle, OrleansTaskScheduler scheduler, ActivationDirectory activationDirectory, ILoggerFactory loggerFactory) { this.loggerFactory = loggerFactory; this.siloStatusOracle = siloStatusOracle; this.scheduler = scheduler; this.activationDirectory = activationDirectory; this.consistentRingProvider = consistentRingProvider; this.runtimeClient = runtimeClient; this.ServiceId = clusterOptions.Value.ServiceId; this.SiloIdentity = siloDetails.SiloAddress.ToLongString(); this.grainBasedPubSub = new GrainBasedPubSubRuntime(this.GrainFactory); var tmp = new ImplicitStreamPubSub(this.runtimeClient.InternalGrainFactory, implicitStreamSubscriberTable); this.implictPubSub = tmp; this.combinedGrainBasedAndImplicitPubSub = new StreamPubSubImpl(this.grainBasedPubSub, tmp); }
/// <summary> /// Adds CancellationToken to the grain extension /// so that it can be cancelled through remote call to the CancellationSourcesExtension. /// </summary> /// <param name="target"></param> /// <param name="request"></param> /// <param name="logger"></param> /// <param name="siloRuntimeClient"></param> internal static void RegisterCancellationTokens( IAddressable target, InvokeMethodRequest request, Logger logger, ISiloRuntimeClient siloRuntimeClient) { for (var i = 0; i < request.Arguments.Length; i++) { var arg = request.Arguments[i]; if (!(arg is GrainCancellationToken)) continue; var grainToken = ((GrainCancellationToken) request.Arguments[i]); CancellationSourcesExtension cancellationExtension; if (!siloRuntimeClient.TryGetExtensionHandler(out cancellationExtension)) { cancellationExtension = new CancellationSourcesExtension(); if (!siloRuntimeClient.TryAddExtension(cancellationExtension)) { logger.Error( ErrorCode.CancellationExtensionCreationFailed, $"Could not add cancellation token extension to: {target}"); return; } } // Replacing the half baked GrainCancellationToken that came from the wire with locally fully created one. request.Arguments[i] = cancellationExtension.RecordCancellationToken(grainToken.Id, grainToken.IsCancellationRequested); } }
/// <summary> /// Adds CancellationToken to the grain extension /// so that it can be cancelled through remote call to the CancellationSourcesExtension. /// </summary> /// <param name="target"></param> /// <param name="request"></param> /// <param name="logger"></param> /// <param name="siloRuntimeClient"></param> internal static void RegisterCancellationTokens( IAddressable target, InvokeMethodRequest request, Logger logger, ISiloRuntimeClient siloRuntimeClient) { for (var i = 0; i < request.Arguments.Length; i++) { var arg = request.Arguments[i]; if (!(arg is GrainCancellationToken)) { continue; } var grainToken = ((GrainCancellationToken)request.Arguments[i]); CancellationSourcesExtension cancellationExtension; if (!siloRuntimeClient.TryGetExtensionHandler(out cancellationExtension)) { cancellationExtension = new CancellationSourcesExtension(); if (!siloRuntimeClient.TryAddExtension(cancellationExtension)) { logger.Error( ErrorCode.CancellationExtensionCreationFailed, $"Could not add cancellation token extension to: {target}"); return; } } // Replacing the half baked GrainCancellationToken that came from the wire with locally fully created one. request.Arguments[i] = cancellationExtension.RecordCancellationToken(grainToken.Id, grainToken.IsCancellationRequested); } }
public SiloProviderRuntime( SiloInitializationParameters siloDetails, GlobalConfiguration config, IGrainFactory grainFactory, IConsistentRingProvider consistentRingProvider, ISiloRuntimeClient runtimeClient, IServiceProvider serviceProvider, ImplicitStreamSubscriberTable implicitStreamSubscriberTable, ISiloStatusOracle siloStatusOracle, OrleansTaskScheduler scheduler, ActivationDirectory activationDirectory) { this.siloDetails = siloDetails; this.siloStatusOracle = siloStatusOracle; this.scheduler = scheduler; this.activationDirectory = activationDirectory; this.consistentRingProvider = consistentRingProvider; this.runtimeClient = runtimeClient; this.ServiceId = config.ServiceId; this.SiloIdentity = siloDetails.SiloAddress.ToLongString(); this.GrainFactory = grainFactory; this.ServiceProvider = serviceProvider; this.grainBasedPubSub = new GrainBasedPubSubRuntime(this.GrainFactory); var tmp = new ImplicitStreamPubSub(implicitStreamSubscriberTable); this.implictPubSub = tmp; this.combinedGrainBasedAndImplicitPubSub = new StreamPubSubImpl(this.grainBasedPubSub, tmp); }
/// <summary> /// Currently we only support a single GrainService per Silo, when multiple are supported we will request the number of GrainServices to partition per silo here. /// </summary> protected GrainServiceClient(IServiceProvider serviceProvider) { runtimeClient = serviceProvider.GetRequiredService <ISiloRuntimeClient>(); grainFactory = serviceProvider.GetRequiredService <IInternalGrainFactory>(); ringProvider = serviceProvider.GetRequiredService <IConsistentRingProvider>(); // GrainInterfaceMap only holds IGrain types, not ISystemTarget types, so resolved via Orleans.CodeGeneration. // Resolve this before merge. grainTypeCode = GrainInterfaceUtils.GetGrainClassTypeCode(typeof(TGrainService)); }
internal IReminderService CreateReminderService(Silo silo, IGrainFactory grainFactory, TimeSpan iniTimeSpan, ISiloRuntimeClient runtimeClient) { var reminderServiceType = silo.GlobalConfig.ReminderServiceType; logger.Info("Creating reminder system target for type={0}", Enum.GetName(typeof(GlobalConfiguration.ReminderServiceProviderType), reminderServiceType)); ReminderTable.Initialize(silo, grainFactory, silo.GlobalConfig.ReminderTableAssembly); return new LocalReminderService( silo.SiloAddress, Constants.ReminderServiceId, silo.RingProvider, silo.LocalScheduler, ReminderTable.Singleton, silo.GlobalConfig, iniTimeSpan); }
internal IReminderService CreateReminderService( Silo silo, TimeSpan iniTimeSpan, ISiloRuntimeClient runtimeClient) { logger.Info( "Creating reminder grain service for type={0}", this.reminderTable.GetType()); // GrainInterfaceMap only holds IGrain types, not ISystemTarget types, so resolved via Orleans.CodeGeneration. // Resolve this before merge. var typeCode = GrainInterfaceUtils.GetGrainClassTypeCode(typeof(IReminderService)); var grainId = GrainId.GetGrainServiceGrainId(0, typeCode); return(new LocalReminderService(silo, grainId, this.reminderTable, iniTimeSpan, this.loggerFactory)); }
public GrainRuntime( GlobalConfiguration globalConfig, ILocalSiloDetails localSiloDetails, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager, IServiceProvider serviceProvider, ISiloRuntimeClient runtimeClient) { this.runtimeClient = runtimeClient; ServiceId = globalConfig.ServiceId; SiloIdentity = localSiloDetails.SiloAddress.ToLongString(); GrainFactory = grainFactory; TimerRegistry = timerRegistry; ReminderRegistry = reminderRegistry; StreamProviderManager = streamProviderManager; ServiceProvider = serviceProvider; }
public GrainRuntime( IOptions <ClusterOptions> clusterOptions, ILocalSiloDetails localSiloDetails, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider, ISiloRuntimeClient runtimeClient, ILoggerFactory loggerFactory) { this.runtimeClient = runtimeClient; ServiceId = clusterOptions.Value.ServiceId; SiloAddress = localSiloDetails.SiloAddress; SiloIdentity = SiloAddress.ToLongString(); this.grainFactory = grainFactory; this.timerRegistry = timerRegistry; this.reminderRegistry = reminderRegistry; this.serviceProvider = serviceProvider; this.loggerFactory = loggerFactory; }
public SiloProviderRuntime( IConsistentRingProvider consistentRingProvider, ISiloRuntimeClient runtimeClient, ImplicitStreamSubscriberTable implicitStreamSubscriberTable, OrleansTaskScheduler scheduler, ActivationDirectory activationDirectory, ILoggerFactory loggerFactory, ILocalSiloDetails siloDetails) { this.loggerFactory = loggerFactory; this.siloDetails = siloDetails; this.scheduler = scheduler; this.activationDirectory = activationDirectory; this.consistentRingProvider = consistentRingProvider; this.runtimeClient = runtimeClient; this.logger = this.loggerFactory.CreateLogger <SiloProviderRuntime>(); this.grainBasedPubSub = new GrainBasedPubSubRuntime(this.GrainFactory); var tmp = new ImplicitStreamPubSub(this.runtimeClient.InternalGrainFactory, implicitStreamSubscriberTable); this.implictPubSub = tmp; this.combinedGrainBasedAndImplicitPubSub = new StreamPubSubImpl(this.grainBasedPubSub, tmp); }
public SiloProviderRuntime( Silo silo, GlobalConfiguration config, IGrainFactory grainFactory, IConsistentRingProvider consistentRingProvider, ISiloRuntimeClient runtimeClient, IServiceProvider serviceProvider, ImplicitStreamSubscriberTable implicitStreamSubscriberTable) { this.silo = silo; this.consistentRingProvider = consistentRingProvider; this.runtimeClient = runtimeClient; this.ServiceId = config.ServiceId; this.SiloIdentity = silo.SiloAddress.ToLongString(); this.GrainFactory = grainFactory; this.ServiceProvider = serviceProvider; this.grainBasedPubSub = new GrainBasedPubSubRuntime(this.GrainFactory); var tmp = new ImplicitStreamPubSub(implicitStreamSubscriberTable); this.implictPubSub = tmp; this.combinedGrainBasedAndImplicitPubSub = new StreamPubSubImpl(this.grainBasedPubSub, tmp); }
public StreamLifecycleConsumerInternalGrain(ILoggerFactory loggerFactory, ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime) : base(runtimeClient, streamProviderRuntime, loggerFactory) { }
public FilteredStreamConsumerGrain(ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime) : base(runtimeClient, streamProviderRuntime) { }
public StreamLifecycleConsumerInternalGrain(ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime) : base(runtimeClient, streamProviderRuntime) { }
public FilteredStreamConsumerGrain(ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime, ILoggerFactory loggerFactory) : base(runtimeClient, streamProviderRuntime, loggerFactory) { staticLogger = loggerFactory.CreateLogger <FilteredStreamConsumerGrain>(); }
public StreamLifecycleConsumerGrain(ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime) { this.runtimeClient = runtimeClient; this.streamProviderRuntime = streamProviderRuntime; }
public ExtensionTestGrain(ISiloRuntimeClient runtimeClient) { this.runtimeClient = runtimeClient; }
public StreamLifecycleConsumerGrain(ISiloRuntimeClient runtimeClient, IStreamProviderRuntime streamProviderRuntime, ILoggerFactory loggerFactory) : base(loggerFactory) { this.runtimeClient = runtimeClient; this.streamProviderRuntime = streamProviderRuntime; }
public GenericExtensionTestGrain() { this.runtimeClient = this.ServiceProvider.GetRequiredService <ISiloRuntimeClient>(); }
public GenericGrainWithNonGenericExtension(ISiloRuntimeClient runtimeClient) { this.runtimeClient = runtimeClient; }
internal IReminderService CreateReminderService(Silo silo, IGrainFactory grainFactory, TimeSpan iniTimeSpan, ISiloRuntimeClient runtimeClient) { var reminderServiceType = silo.GlobalConfig.ReminderServiceType; logger.Info("Creating reminder grain service for type={0}", Enum.GetName(typeof(GlobalConfiguration.ReminderServiceProviderType), reminderServiceType)); // GrainInterfaceMap only holds IGrain types, not ISystemTarget types, so resolved via Orleans.CodeGeneration. // Resolve this before merge. var typeCode = GrainInterfaceUtils.GetGrainClassTypeCode(typeof(IReminderService)); var grainId = GrainId.GetGrainServiceGrainId(0, typeCode); ReminderTable.Initialize(silo, grainFactory, silo.GlobalConfig.ReminderTableAssembly); return(new LocalReminderService( silo, grainId, ReminderTable.Singleton, silo.GlobalConfig, iniTimeSpan)); }
internal IReminderService CreateReminderService(Silo silo, IGrainFactory grainFactory, TimeSpan iniTimeSpan, ISiloRuntimeClient runtimeClient) { var reminderServiceType = silo.GlobalConfig.ReminderServiceType; logger.Info("Creating reminder system target for type={0}", Enum.GetName(typeof(GlobalConfiguration.ReminderServiceProviderType), reminderServiceType)); ReminderTable.Initialize(silo, grainFactory, silo.GlobalConfig.ReminderTableAssembly); return(new LocalReminderService( silo.SiloAddress, Constants.ReminderServiceId, silo.RingProvider, silo.LocalScheduler, ReminderTable.Singleton, silo.GlobalConfig, iniTimeSpan)); }