Example #1
0
        readonly Timer compactionTimer; // TODO: Bug logged to be fixed to proper dispose and test.

        DbStoreProvider(IRocksDbOptionsProvider optionsProvider, IRocksDb db, IDictionary <string, IDbStore> entityDbStoreDictionary)
        {
            this.db = db;
            this.optionsProvider         = optionsProvider;
            this.entityDbStoreDictionary = new ConcurrentDictionary <string, IDbStore>(entityDbStoreDictionary);
            this.compactionTimer         = new Timer(this.RunCompaction, null, CompactionPeriod, CompactionPeriod);
        }
Example #2
0
        public ColumnFamilyDbStore(IRocksDb db, ColumnFamilyHandle handle)
        {
            this.db     = Preconditions.CheckNotNull(db, nameof(db));
            this.Handle = Preconditions.CheckNotNull(handle, nameof(handle));

            var iterator = db.NewIterator(this.Handle);

            this.count = 0;
            while (iterator.Valid())
            {
                this.count += 1;
                iterator    = iterator.Next();
            }
        }
Example #3
0
        public static DbStoreProvider Create(IRocksDbOptionsProvider optionsProvider, string path, IEnumerable <string> partitionsList)
        {
            IRocksDb                       db                      = RocksDbWrapper.Create(optionsProvider, path, partitionsList);
            IEnumerable <string>           columnFamilies          = db.ListColumnFamilies();
            IDictionary <string, IDbStore> entityDbStoreDictionary = new Dictionary <string, IDbStore>();

            foreach (string columnFamilyName in columnFamilies)
            {
                ColumnFamilyHandle handle = db.GetColumnFamily(columnFamilyName);
                var dbStorePartition      = new ColumnFamilyDbStore(db, handle);
                entityDbStoreDictionary[columnFamilyName] = dbStorePartition;
            }
            var dbStore = new DbStoreProvider(optionsProvider, db, entityDbStoreDictionary);

            return(dbStore);
        }
Example #4
0
 public ColumnFamilyDbStore(IRocksDb db, ColumnFamilyHandle handle)
 {
     this.db     = Preconditions.CheckNotNull(db, nameof(db));
     this.Handle = Preconditions.CheckNotNull(handle, nameof(handle));
 }