/// <inheritdoc />
        public Task <BoolResult> StartupAsync(Context context)
        {
            StartupStarted = true;
            return(StartupCall <ContentSessionTracer> .RunAsync(
                       _tracer,
                       context,
                       async() =>
            {
                _tracer.TraceStartupConfiguration(context, _configuration);

                if (_configuration.RedisGlobalStoreConnectionString != null)
                {
                    _redisDatabaseFactoryForRedisGlobalStore = await RedisDatabaseFactory.CreateAsync(
                        context,
                        new LiteralConnectionStringProvider(_configuration.RedisGlobalStoreConnectionString));

                    if (_configuration.RedisGlobalStoreSecondaryConnectionString != null)
                    {
                        _redisDatabaseFactoryForRedisGlobalStoreSecondary = await RedisDatabaseFactory.CreateAsync(
                            context,
                            new LiteralConnectionStringProvider(_configuration.RedisGlobalStoreSecondaryConnectionString));
                    }
                }
                else
                {
                    // Local location store can only be used if connection string is provided for redis global store
                    Contract.Assert(!_configuration.HasReadOrWriteMode(ContentLocationMode.LocalLocationStore));
                }

                _redisDatabaseFactoryForContent = await RedisDatabaseFactory.CreateAsync(context, _contentConnectionStringProvider);
                _redisDatabaseFactoryForMachineLocations = await RedisDatabaseFactory.CreateAsync(context, _machineConnectionStringProvider);
                StartupCompleted = true;
                return BoolResult.Success;
            }));
        }
Пример #2
0
        /// <inheritdoc />
        protected override async Task <BoolResult> StartupCoreAsync(OperationContext context)
        {
            Tracer.TraceStartupConfiguration(context, Configuration);

            if (Configuration.RedisGlobalStoreConnectionString != null)
            {
                RedisDatabaseFactoryForRedisGlobalStore = await RedisDatabaseFactory.CreateAsync(
                    context,
                    new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreConnectionString));

                if (Configuration.RedisGlobalStoreSecondaryConnectionString != null)
                {
                    RedisDatabaseFactoryForRedisGlobalStoreSecondary = await RedisDatabaseFactory.CreateAsync(
                        context,
                        new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreSecondaryConnectionString));
                }
            }
            else
            {
                // Local location store can only be used if connection string is provided for redis global store
                Contract.Assert(!Configuration.HasReadOrWriteMode(ContentLocationMode.LocalLocationStore));
            }

            // Instantiate factories for old redis only when we use old redis.
            if (Configuration.HasReadOrWriteMode(ContentLocationMode.Redis))
            {
                Contract.Assert(_contentConnectionStringProvider != null);
                Contract.Assert(_machineConnectionStringProvider != null);
                RedisDatabaseFactoryForContent = await RedisDatabaseFactory.CreateAsync(context, _contentConnectionStringProvider);

                RedisDatabaseFactoryForMachineLocations = await RedisDatabaseFactory.CreateAsync(context, _machineConnectionStringProvider);
            }

            return(BoolResult.Success);
        }
Пример #3
0
        protected override async Task <BoolResult> StartupCoreAsync(OperationContext context)
        {
            Tracer.TraceStartupConfiguration(context, Configuration);

            RedisDatabaseFactoryForRedisGlobalStore = await RedisDatabaseFactory.CreateAsync(
                context,
                new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreConnectionString));

            if (Configuration.RedisGlobalStoreSecondaryConnectionString != null)
            {
                RedisDatabaseFactoryForRedisGlobalStoreSecondary = await RedisDatabaseFactory.CreateAsync(
                    context,
                    new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreSecondaryConnectionString));
            }

            return(BoolResult.Success);
        }
        protected override async Task <BoolResult> StartupCoreAsync(OperationContext context)
        {
            Tracer.TraceStartupConfiguration(context, Configuration);

            RedisDatabaseFactoryForRedisGlobalStore = await RedisDatabaseFactory.CreateAsync(
                context,
                new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreConnectionString),
                logSeverity : Configuration.RedisInternalLogSeverity ?? Severity.Unknown,
                usePreventThreadTheft : Configuration.UsePreventThreadTheftFeature);

            if (Configuration.RedisGlobalStoreSecondaryConnectionString != null)
            {
                RedisDatabaseFactoryForRedisGlobalStoreSecondary = await RedisDatabaseFactory.CreateAsync(
                    context,
                    new LiteralConnectionStringProvider(Configuration.RedisGlobalStoreSecondaryConnectionString),
                    logSeverity : Configuration.RedisInternalLogSeverity ?? Severity.Unknown,
                    usePreventThreadTheft : Configuration.UsePreventThreadTheftFeature);
            }

            return(BoolResult.Success);
        }