/** * Delete a range of keys from a table */ @Override public void delete(String table, byte[] keyFrom, byte[] keyTo) { this.batch.deleteRange(cf(table), keyFrom, keyTo); }
/** * Delete a record by key(or prefix with key) from a table */ @Override public void delete(String table, byte[] key) { byte[] keyFrom = key; byte[] keyTo = Arrays.copyOf(key, key.length); keyTo = BinarySerializer.increaseOne(keyTo); this.batch.deleteRange(cf(table), keyFrom, keyTo); }
/** * Delete a range of keys from a table */ @Override public void delete(String table, byte[] keyFrom, byte[] keyTo) { this.batch.deleteRange(cf(table), keyFrom, keyTo); }
@Override public void deleteRange(byte[] beginKey, byte[] endKey) throws IOException { try { writeBatch.deleteRange(beginKey, endKey); } catch (RocksDBException e) { throw new IOException("Failed to flush RocksDB batch", e); } }
/** * Delete a record by key(or prefix with key) from a table */ @Override public void delete(String table, byte[] key) { byte[] keyFrom = key; byte[] keyTo = Arrays.copyOf(key, key.length); keyTo = increaseOne(keyTo); this.batch.deleteRange(cf(table), keyFrom, keyTo); }
/** * Delete blind should be call as the last op in the delete operations. * Since we need to modify endKey to make {@link WriteBatch#deleteRange(byte[], byte[])} * delete the end key. */ void deleteBlind(WriteBatch batch, byte[] key, @Nullable byte[] endKey) { try { if (null == endKey) { batch.delete(key); } else { Pair<byte[], byte[]> realRange = getRealRange(key, endKey); endKey = realRange.getRight(); ++endKey[endKey.length - 1]; batch.deleteRange(realRange.getLeft(), endKey); } } catch (RocksDBException e) { throw new StateStoreRuntimeException(e); } }