public WriteLog(int shardId, string databaseDir, MetaStoreOptions options, long directoryEntriesBytes, ILogger logger)
 {
     this.shardId               = shardId;
     this.databaseDir           = databaseDir;
     this.options               = options;
     this.logger                = logger;
     this.directoryEntriesBytes = directoryEntriesBytes;
 }
Esempio n. 2
0
        public MetaStore(MetaStoreOptions options, HybridCacheOptions cacheOptions, ILogger logger)
        {
            if (options.Shards <= 0 || options.Shards > 2048)
            {
                throw new ArgumentException("Shards must be between 1 and 2048");
            }

            var pathBuilder =
                new HashBasedPathBuilder(cacheOptions.PhysicalCacheDir, cacheOptions.Subfolders, '/', ".jpg");

            var directoryEntriesBytes = pathBuilder.GetDirectoryEntriesBytesTotal() + CleanupManager.DirectoryEntrySize();

            var shardCount = options.Shards;

            shards = new Shard[shardCount];
            for (var i = 0; i < shardCount; i++)
            {
                shards[i] = new Shard(i, options, Path.Combine(options.DatabaseDir, "db", i.ToString()), directoryEntriesBytes / shardCount, logger);
            }
        }
Esempio n. 3
0
 internal Shard(int shardId, MetaStoreOptions options, string databaseDir, long directoryEntriesBytes, ILogger logger)
 {
     this.shardId = shardId;
     this.logger  = logger;
     writeLog     = new WriteLog(shardId, databaseDir, options, directoryEntriesBytes + CleanupManager.DirectoryEntrySize(), logger);
 }