private KeyValueStoreAccessor( string storeDirectory, int storeVersion, bool defaultColumnKeyTracked, IEnumerable <string> additionalColumns, IEnumerable <string> additionalKeyTrackedColumns, Action <Failure> failureHandler, bool openReadOnly, bool dropColumns, bool createdNewStore) { Contract.Assert(storeVersion != VersionConstants.InvalidStore, "No store should pass the invalid store version since it is not safe to open an invalid store."); StoreDirectory = storeDirectory; ReadOnly = openReadOnly; StoreVersion = storeVersion; CreatedNewStore = createdNewStore; m_store = new RocksDbStore( StoreDirectory, defaultColumnKeyTracked, additionalColumns, additionalKeyTrackedColumns, openReadOnly, dropColumns); m_failureHandler = failureHandler; }
/// <summary> /// Create an instance by getting a snapshot from the given KeyValueStore accessor. /// </summary> public KeyValueStoreAccessor(KeyValueStoreAccessor accessor) { StoreDirectory = accessor.StoreDirectory; ReadOnly = true; StoreVersion = accessor.StoreVersion; CreatedNewStore = false; m_store = accessor.m_store.CreateSnapshot(); m_failureHandler = accessor.m_failureHandler; }
private KeyValueStoreAccessor( RocksDbStoreArguments storeArguments, int storeVersion, Action <RocksDbFailureEvent> failureHandler, bool createdNewStore, Action <Failure <Exception> > invalidationHandler) { Contract.Assert(storeVersion != VersionConstants.InvalidStore, "No store should pass the invalid store version since it is not safe to open an invalid store."); StoreDirectory = storeArguments.StoreDirectory; ReadOnly = storeArguments.ReadOnly; StoreVersion = storeVersion; CreatedNewStore = createdNewStore; m_store = new RocksDbStore(storeArguments); m_failureHandler = failureHandler; m_invalidationHandler = invalidationHandler; }
/// <summary> /// Create an instance by getting a snapshot from the given KeyValueStore accessor. /// </summary> public KeyValueStoreAccessor(KeyValueStoreAccessor accessor) { StoreDirectory = accessor.StoreDirectory; ReadOnly = true; StoreVersion = accessor.StoreVersion; CreatedNewStore = false; m_invalidateStoreOnDispose = accessor.m_invalidateStoreOnDispose; m_failureHandler = accessor.m_failureHandler; m_disabledFailure = accessor.m_disabledFailure; m_disposed = accessor.m_disposed; m_invalidationHandler = accessor.m_invalidationHandler; if (accessor.Disabled) { // Creating a snapshot of a disabled store will carry the error along, so it should never be accessed. m_store = null; } else { m_store = accessor.m_store.CreateSnapshot(); } }