public DistributedCentralStorage(
            DistributedCentralStoreConfiguration configuration,
            ILocationStore locationStore,
            IDistributedContentCopier copier,
            CentralStorage fallbackStorage)
        {
            _configuration = configuration;
            _copier = copier;
            _fallbackStorage = fallbackStorage;
            _locationStore = locationStore;

            var maxRetentionMb = configuration.MaxRetentionGb * 1024;
            var softRetentionMb = (int)(maxRetentionMb * 0.8);

            var cacheFolder = configuration.CacheRoot / CacheSubFolderName;

            _copierWorkingDirectory = new DisposableDirectory(copier.FileSystem, cacheFolder / "Temp");

            // Create a private CAS for storing checkpoint data
            // Avoid introducing churn into primary CAS
            _privateCas = new FileSystemContentStoreInternal(
                copier.FileSystem,
                SystemClock.Instance,
                cacheFolder,
                new ConfigurationModel(
                    new ContentStoreConfiguration(new MaxSizeQuota(hardExpression: maxRetentionMb + "MB", softExpression: softRetentionMb + "MB")),
                    ConfigurationSelection.RequireAndUseInProcessConfiguration),
                settings: new ContentStoreSettings()
                {
                    TraceFileSystemContentStoreDiagnosticMessages = _configuration.TraceFileSystemContentStoreDiagnosticMessages,
                    SelfCheckSettings = _configuration.SelfCheckSettings,
                });
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisContentLocationStoreFactory"/> class.
        /// </summary>
        public RedisContentLocationStoreFactory(
            /*CanBeNull*/ IConnectionStringProvider contentConnectionStringProvider,
            /*CanBeNull*/ IConnectionStringProvider machineLocationConnectionStringProvider,
            IClock clock,
            TimeSpan contentHashBumpTime,
            RedisContentLocationStoreConfiguration configuration,
            IDistributedContentCopier copier)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(configuration.Keyspace));

            _contentConnectionStringProvider = contentConnectionStringProvider;
            _machineConnectionStringProvider = machineLocationConnectionStringProvider;
            Clock = clock;
            _contentHashBumpTime = contentHashBumpTime;
            _copier = copier;
            _lazyLocalLocationStore = new Lazy <LocalLocationStore>(() => CreateLocalLocationStore());
            Configuration           = configuration;

            if (Configuration.HasReadOrWriteMode(ContentLocationMode.Redis))
            {
                Contract.Assert(contentConnectionStringProvider != null, "When ReadFromRedis is on 'contentConnectionStringProvider' must not be null.");
                Contract.Assert(machineLocationConnectionStringProvider != null, "When ReadFromRedis is on 'machineLocationConnectionStringProvider' must not be null.");
            }
        }
Beispiel #3
0
 /// <nodoc />
 public RedisMemoizationStoreFactory(
     IClock clock,
     RedisMemoizationStoreConfiguration configuration,
     IDistributedContentCopier copier)
     : base(clock, configuration, copier)
 {
 }
Beispiel #4
0
 /// <nodoc />
 public RedisMemoizationStoreFactory(
     IConnectionStringProvider contentConnectionStringProvider,
     IConnectionStringProvider machineLocationConnectionStringProvider,
     IClock clock,
     TimeSpan contentHashBumpTime,
     RedisMemoizationStoreConfiguration configuration,
     IDistributedContentCopier copier)
     : base(contentConnectionStringProvider, machineLocationConnectionStringProvider, clock, contentHashBumpTime, configuration, copier)
 {
     _memoizationExpiryTime = configuration.MemoizationExpiryTime;
 }
Beispiel #5
0
        public ContentLocationStoreFactory(
            IClock clock,
            RedisContentLocationStoreConfiguration configuration,
            IDistributedContentCopier copier)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(!string.IsNullOrEmpty(configuration.RedisGlobalStoreConnectionString));
            Contract.Requires(!string.IsNullOrWhiteSpace(configuration.Keyspace));
            Contract.Requires(copier != null);

            Clock  = clock;
            Copier = copier;
            _lazyLocalLocationStore = new Lazy <LocalLocationStore>(() => CreateLocalLocationStore());
            Configuration           = configuration;
        }
        /// <nodoc />
        public DistributedCentralStorage(
            DistributedCentralStoreConfiguration configuration,
            IDistributedContentCopier copier,
            CentralStorage fallbackStorage)
        {
            _configuration   = configuration;
            _copier          = copier;
            _fallbackStorage = fallbackStorage;

            var maxRetentionMb  = configuration.MaxRetentionGb * 1024;
            var softRetentionMb = (int)(maxRetentionMb * 0.8);

            // Create a private CAS for storing checkpoint data
            // Avoid introducing churn into primary CAS
            _privateCas = new FileSystemContentStoreInternal(
                new PassThroughFileSystem(),
                SystemClock.Instance,
                configuration.CacheRoot / CacheSubFolderName,
                new ConfigurationModel(
                    new ContentStoreConfiguration(new MaxSizeQuota(hardExpression: maxRetentionMb + "MB", softExpression: softRetentionMb + "MB")),
                    ConfigurationSelection.RequireAndUseInProcessConfiguration));
        }