public CachingCentralStorage(
            DistributedCentralStoreConfiguration configuration,
            CentralStorage fallbackStorage,
            IAbsFileSystem fileSystem)
        {
            Configuration    = configuration;
            _fallbackStorage = fallbackStorage;

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

            var cacheFolder = configuration.CacheRoot / CacheSubFolderName;

            // Create a private CAS for storing checkpoint data
            // Avoid introducing churn into primary CAS
            PrivateCas = new FileSystemContentStoreInternal(
                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,
            });
        }
        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,
                });
        }
示例#3
0
 /// <inheritdoc />
 public MemoryContentLocationEventStore(
     MemoryContentLocationEventStoreConfiguration configuration,
     IContentLocationEventHandler handler,
     CentralStorage centralStorage,
     Interfaces.FileSystem.AbsolutePath workingDirectory)
     : base(configuration, nameof(MemoryContentLocationEventStore), handler, centralStorage, workingDirectory)
 {
     _hub          = configuration.Hub;
     _hub.OnEvent += HubOnEvent;
 }
        public DistributedCentralStorage(
            DistributedCentralStoreConfiguration configuration,
            ILocationStore locationStore,
            DistributedContentCopier copier,
            CentralStorage fallbackStorage,
            IClock clock)
            : base(configuration, fallbackStorage, copier.FileSystem)
        {
            _copier           = copier;
            _locationStore    = locationStore;
            _checkpointCopies = new VolatileMap <ShortHash, CopyOperation>(clock);
            _checkpointStore  = configuration.IsCheckpointAware ? _locationStore as ICheckpointStore : null;

            _copierWorkingDirectory = new DisposableDirectory(copier.FileSystem, PrivateCas !.RootPath / "Temp");
        }
示例#5
0
        /// <inheritdoc />
        public CheckpointManager(
            ContentLocationDatabase database,
            ICheckpointRegistry checkpointRegistry,
            CentralStorage storage,
            CheckpointConfiguration configuration,
            CounterCollection <ContentLocationStoreCounters> counters)
        {
            _database                   = database;
            _checkpointRegistry         = checkpointRegistry;
            _storage                    = storage;
            _configuration              = configuration;
            _fileSystem                 = new PassThroughFileSystem();
            _checkpointStagingDirectory = configuration.WorkingDirectory / "staging";

            Counters = counters;
        }
示例#6
0
        /// <inheritdoc />
        public CheckpointManager(
            ContentLocationDatabase database,
            ICheckpointRegistry checkpointRegistry,
            CentralStorage storage,
            CheckpointConfiguration configuration,
            CounterCollection <ContentLocationStoreCounters> counters)
        {
            _database                       = database;
            _checkpointRegistry             = checkpointRegistry;
            _storage                        = storage;
            _configuration                  = configuration;
            _fileSystem                     = new PassThroughFileSystem();
            _checkpointStagingDirectory     = configuration.WorkingDirectory / "staging";
            _incrementalCheckpointDirectory = configuration.WorkingDirectory / "incremental";
            _lastCheckpointFile             = configuration.WorkingDirectory / "lastCheckpoint.txt";
            _fileSystem.CreateDirectory(_incrementalCheckpointDirectory);

            _incrementalCheckpointInfoFile = _incrementalCheckpointDirectory / "checkpointInfo.txt";
            Counters = counters;
        }
        /// <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));
        }
示例#8
0
        /// <inheritdoc />
        public CheckpointManager(
            ContentLocationDatabase database,
            ICheckpointRegistry checkpointRegistry,
            CentralStorage storage,
            CheckpointManagerConfiguration configuration,
            CounterCollection <ContentLocationStoreCounters> counters,
            ICheckpointObserver checkpointObserver = null)
        {
            Database                    = database;
            CheckpointRegistry          = checkpointRegistry;
            Storage                     = storage;
            _configuration              = configuration;
            _fileSystem                 = new PassThroughFileSystem();
            _checkpointStagingDirectory = configuration.WorkingDirectory / "staging";
            _checkpointObserver         = checkpointObserver;
            Counters                    = counters;

            LinkLifetime(Database);
            LinkLifetime(CheckpointRegistry);
            LinkLifetime(_checkpointObserver);
            LinkLifetime(Storage);
        }