/** * Clears the storage of all registered backend data providers. This includes backend storage * engines and index providers. * * <p>IMPORTANT: Clearing storage means that ALL data will be lost and cannot be recovered. * * @throws StorageException */ public void clearStorage() throws StorageException { edgeStore.close(); vertexIndexStore.close(); edgeIndexStore.close(); idAuthority.close(); storeManager.clearStorage(); // Indexes for (IndexProvider index : indexes.values()) index.clearStorage(); }
@Override public void mutateMany( Map<String, Map<StaticBuffer, KCVMutation>> mutations, StoreTransaction txh) throws BackendException { for (Map.Entry<String, Map<StaticBuffer, KCVMutation>> storeMut : mutations.entrySet()) { KeyColumnValueStore store = stores.get(storeMut.getKey()); Preconditions.checkNotNull(store); for (Map.Entry<StaticBuffer, KCVMutation> keyMut : storeMut.getValue().entrySet()) { store.mutate( keyMut.getKey(), keyMut.getValue().getAdditions(), keyMut.getValue().getDeletions(), txh); } } }
private KeyColumnValueStore getLockStore(KeyColumnValueStore store) throws StorageException { if (!storeFeatures.supportsLocking()) { if (storeFeatures.isTransactional()) { store = new TransactionalLockStore(store); } else if (storeFeatures.supportsConsistentKeyOperations()) { store = new ConsistentKeyLockStore( store, getStore(store.getName() + LOCK_STORE_SUFFIX), lockConfiguration); } else throw new IllegalArgumentException("Store needs to support some form of locking"); } return store; }
@Test public void addRecords() throws StorageException { for (int r = 0; r < numRows; r++) { int numCols = 10; List<Entry> entries = new ArrayList<Entry>(); for (int c = 0; c < numCols; c++) { entries.add( new StaticBufferEntry( KeyValueStoreUtil.getBuffer(c + 1), KeyValueStoreUtil.getBuffer(c + r + 2))); } store.mutate( KeyValueStoreUtil.getBuffer(r + 1), entries, KeyColumnValueStore.NO_DELETIONS, tx); } tx.commit(); tx = null; }
private KeyColumnValueStore getLockStore(KeyColumnValueStore store, boolean lockEnabled) throws StorageException { if (!storeFeatures.supportsLocking()) { if (storeFeatures.supportsTransactions()) { store = new TransactionalLockStore(store); } else if (storeFeatures.supportsConsistentKeyOperations()) { if (lockEnabled) { final String lockerName = store.getName() + LOCK_STORE_SUFFIX; store = new ExpectedValueCheckingStore(store, getLocker(lockerName)); } else { store = new ExpectedValueCheckingStore(store, null); } } else throw new IllegalArgumentException("Store needs to support some form of locking"); } return store; }
public void close() throws StorageException { if (tx != null) tx.commit(); store.close(); manager.close(); }
public void clearStorage() throws StorageException { edgeStore.close(); vertexIndexStore.close(); idAuthority.close(); storeManager.clearStorage(); }