public IDbStore GetDbStore(string partitionName) { Preconditions.CheckNonWhiteSpace(partitionName, nameof(partitionName)); if (!this.entityDbStoreDictionary.TryGetValue(partitionName, out IDbStore entityDbStore)) { ColumnFamilyHandle handle = this.db.CreateColumnFamily(this.optionsProvider.GetColumnFamilyOptions(), partitionName); entityDbStore = new ColumnFamilyDbStore(this.db, handle); entityDbStore = this.entityDbStoreDictionary.GetOrAdd(partitionName, entityDbStore); } return(entityDbStore); }
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); }