private static void ReportServiceStarted( OperationContext context, IDistributedCacheServiceHost host) { LifetimeTracker.ServiceStarted(context); host.OnStartedService(); }
/// <summary> /// Creates and runs a distributed cache service /// </summary> /// <exception cref="CacheException">thrown when cache startup fails</exception> public static Task RunWithConfigurationAsync( ILogger logger, IDistributedCacheServiceHost host, HostInfo hostInfo, ITelemetryFieldsProvider telemetryFieldsProvider, DistributedCacheServiceConfiguration config, CancellationToken token, string keyspace = null) { logger.Info($"CAS log severity set to {config.MinimumLogSeverity}"); var arguments = new DistributedCacheServiceArguments( logger: logger, copier: null, copyRequester: null, host: host, hostInfo: hostInfo, cancellation: token, dataRootPath: config.DataRootPath, configuration: config, keyspace: keyspace) { TelemetryFieldsProvider = telemetryFieldsProvider, BuildCopyInfrastructure = logger => BuildCopyInfrastructure(logger, config), }; return(RunAsync(arguments)); }
public DistributedCacheSecretRetriever(DistributedCacheServiceArguments arguments) { _distributedSettings = arguments.Configuration.DistributedContentSettings; _loggingConfiguration = arguments.LoggingSettings?.Configuration; _logger = arguments.Logger; _host = arguments.Host; _secrets = new Lazy <Task <Result <RetrievedSecrets> > >(TryGetSecretsAsync); }
private static void ReportServiceStarted( OperationContext context, IDistributedCacheServiceHost host, Result <ServiceOfflineDurationTracker> trackerResult, TimeSpan startupDuration) { var shutdownTimeUtc = trackerResult.Then(v => v.GetShutdownTime(context, logTimeStampToFile: true)); LifetimeTrackerTracer.ServiceStarted(context, startupDuration, shutdownTimeUtc); host.OnStartedService(); }
private static void ReportServiceStarted( Context context, IDistributedCacheServiceHost host, Result <ServiceOfflineDurationTracker> trackerResult, TimeSpan startupDuration) { var offlineTimeResult = trackerResult.Then(v => v.GetOfflineDuration(new OperationContext(context))); LifetimeTrackerTracer.ServiceStarted(context, offlineTimeResult, startupDuration); host.OnStartedService(); }
private static async Task ReportServiceStartedAsync( OperationContext context, StartupShutdownSlimBase server, IDistributedCacheServiceHost host) { LifetimeTracker.ServiceStarted(context); host.OnStartedService(); if (host is IDistributedCacheServiceHostInternal hostInternal && server is IServicesProvider sp && sp.TryGetService <ICacheServerServices>(out var services)) { await hostInternal.OnStartedServiceAsync(context, services); } }
private static Task ReportStartingServiceAsync( OperationContext context, IDistributedCacheServiceHost host, DistributedCacheServiceArguments arguments) { var configuration = arguments.Configuration; var logIntervalSeconds = configuration.DistributedContentSettings.ServiceRunningLogInSeconds; var logInterval = logIntervalSeconds != null ? (TimeSpan?)TimeSpan.FromSeconds(logIntervalSeconds.Value) : null; var logFilePath = GetPathForLifetimeTracking(configuration); LifetimeTracker.ServiceStarting(context, logInterval, logFilePath, arguments.TelemetryFieldsProvider.ServiceName); return(host.OnStartingServiceAsync()); }
private static async Task ReportStartingServiceAsync( OperationContext context, IDistributedCacheServiceHost host, DistributedCacheServiceConfiguration configuration) { var logIntervalSeconds = configuration.DistributedContentSettings.ServiceRunningLogInSeconds; var logInterval = logIntervalSeconds != null ? (TimeSpan?)TimeSpan.FromSeconds(logIntervalSeconds.Value) : null; var logFilePath = configuration.LocalCasSettings.GetCacheRootPathWithScenario(LocalCasServiceSettings.DefaultCacheName); LifetimeTracker.ServiceStarting(context, logInterval, logFilePath); if (host is IDistributedCacheServiceHostInternal hostInternal) { await hostInternal.OnStartingServiceAsync(context); } await host.OnStartingServiceAsync(); }
private static async Task ReportServiceStartedAsync( OperationContext context, StartupShutdownSlimBase server, IDistributedCacheServiceHost host, DistributedContentSettings distributedContentSettings) { LifetimeTracker.ServiceStarted(context); host.OnStartedService(); if ( // Don't need to call the following callback for out-of-proc cache distributedContentSettings.OutOfProcCacheSettings is null && host is IDistributedCacheServiceHostInternal hostInternal && server is IServicesProvider sp && sp.TryGetService <ICacheServerServices>(out var services)) { await hostInternal.OnStartedServiceAsync(context, services); } }
/// <inheritdoc /> public DistributedCacheServiceArguments( ILogger logger, IAbsolutePathFileCopier copier, IAbsolutePathTransformer pathTransformer, IDistributedCacheServiceHost host, HostInfo hostInfo, CancellationToken cancellation, string dataRootPath, DistributedCacheServiceConfiguration configuration, string keyspace) { Logger = logger; Copier = copier; PathTransformer = pathTransformer; Host = host; HostInfo = hostInfo; Cancellation = cancellation; DataRootPath = dataRootPath; Configuration = configuration; Keyspace = ComputeKeySpace(hostInfo, configuration, keyspace); }
public HostConnectionStringProvider(IDistributedCacheServiceHost host, string secretKeyName, ILogger logger) { _host = host; _secretKeyName = secretKeyName; _logger = logger; }
public DistributedCacheServiceHostBasedLifetimeManager(IDistributedCacheServiceHost host) => _host = host;
private static void InitializeGlobalLifetimeManager(IDistributedCacheServiceHost host) { LifetimeManager.SetLifetimeManager(new DistributedCacheServiceHostBasedLifetimeManager(host)); }
private static void ReportServiceStopped(Context context, IDistributedCacheServiceHost host, BoolResult result, TimeSpan shutdownDuration) { LifetimeTrackerTracer.ServiceStopped(context, result, shutdownDuration); host.OnTeardownCompleted(); }
private static Task ReportStartingServiceAsync(Context context, IDistributedCacheServiceHost host) { LifetimeTrackerTracer.StartingService(context); return(host.OnStartingServiceAsync()); }
public TestServiceHost(TestHost testHost, IDistributedCacheServiceHost host = null) { _testHost = testHost; _host = host ?? _testHost; _hostInternal = (host as IDistributedCacheServiceHostInternal) ?? _testHost; }
private static void ReportServiceStopped(Context context, IDistributedCacheServiceHost host, BoolResult result) { CacheActivityTracker.Stop(); LifetimeTracker.ServiceStopped(context, result); host.OnTeardownCompleted(); }
private static async Task ReportShuttingDownServiceAsync(OperationContext context, IDistributedCacheServiceHost host) { LifetimeTracker.ShuttingDownService(context); if (host is IDistributedCacheServiceHostInternal hostInternal) { await hostInternal.OnStoppingServiceAsync(context); } }