本文整理了Java中org.rocksdb.RocksDB.remove
方法的一些代码示例,展示了RocksDB.remove
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RocksDB.remove
方法的具体详情如下:
包路径:org.rocksdb.RocksDB
类名称:RocksDB
方法名:remove
[英]Remove the database entry (if any) for "key". Returns OK on success, and a non-OK status on error. It is not an error if "key" did not exist in the database.
[中]删除“key”的数据库条目(如果有)。成功时返回OK,错误时返回非OK状态。如果数据库中不存在“key”,则不是错误。
代码示例来源:origin: alibaba/jstorm
@Override
public void remove(String key) {
try {
db.remove(key.getBytes());
} catch (Exception e) {
LOG.error("Failed to remove " + key);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void remove(K key) throws IOException {
try {
rocksDb.remove(columnFamily, serializer.serialize(key));
} catch (RocksDBException e) {
throw new IOException(String.format("Failed to remove key=%s", key), e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void delete(String key) throws FailStoreException {
try {
db.remove(key.getBytes("UTF-8"));
} catch (Exception e) {
throw new FailStoreException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void delete(String key) throws FailStoreException {
try {
db.remove(key.getBytes("UTF-8"));
} catch (Exception e) {
throw new FailStoreException(e);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public Object get(String key) {
try {
byte[] data = db.get(key.getBytes());
if (data != null) {
try {
return deserialize(data);
} catch (Exception e) {
LOG.error("Failed to deserialize obj of " + key, e);
db.remove(key.getBytes());
return null;
}
}
} catch (Exception ignored) {
}
return null;
}
代码示例来源:origin: alibaba/jstorm
} catch (Exception e) {
LOG.error("Failed to deserialize obj of " + new String(keyByte));
db.remove(keyByte);
continue;
代码示例来源:origin: voldemort/voldemort
getRocksDB().remove(storeHandle, key.get());
return true;
} else {
getRocksDB().remove(storeHandle, key.get());
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
@Override
public void remove(String key) {
try {
db.remove(key.getBytes());
} catch (Exception e) {
LOG.error("Failed to remove " + key);
}
}
代码示例来源:origin: weiboad/fiery
public boolean del(String key) {
if (key.length() == 0) return false;
try {
db.remove(key.getBytes());
return true;
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage());
}
return false;
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public void delete(String key) throws FailStoreException {
try {
db.remove(key.getBytes("UTF-8"));
} catch (Exception e) {
throw new FailStoreException(e);
}
}
代码示例来源:origin: org.apache.flink/flink-statebackend-rocksdb_2.10
@Override
public void remove() {
if (cacheIndex == 0 || cacheIndex > cacheEntries.size()) {
throw new IllegalStateException("The remove operation must be called after an valid next operation.");
}
RocksDBMapEntry lastEntry = cacheEntries.get(cacheIndex - 1);
lastEntry.remove();
}
代码示例来源:origin: apsaltis/StreamingData-Book-Examples
static void removeEvent(final String eventKey) throws Exception{
try {
final byte[] keyBytes = eventKey.getBytes(StandardCharsets.UTF_8);
byte[] value = transientStateDB.get(keyBytes);
if (value != null) {
transientStateDB.remove(keyBytes);
}
} catch (RocksDBException ex) {
//would want to log this occurring
throw new Exception(ex.getMessage());
}
}
代码示例来源:origin: org.apache.flink/flink-statebackend-rocksdb_2.10
@Override
public void clear() {
try {
writeCurrentKeyWithGroupAndNamespace();
byte[] key = keySerializationStream.toByteArray();
backend.db.remove(columnFamily, writeOptions, key);
} catch (IOException|RocksDBException e) {
throw new RuntimeException("Error while removing entry from RocksDB", e);
}
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
@Override
public Object get(String key) {
try {
byte[] data = db.get(key.getBytes());
if (data != null) {
try {
return deserialize(data);
} catch (Exception e) {
LOG.error("Failed to deserialize obj of " + key);
db.remove(key.getBytes());
return null;
}
}
} catch (Exception ignored) {
}
return null;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
public V remove(Object key) {
putAll();
V value = get(key);
try {
ByteArrayOutputStream keyBytes = new ByteArrayOutputStream();
ObjectOutput keyOut = new ObjectOutputStream(keyBytes);
keyOut.writeObject(key);
keyOut.flush();
db.remove(keyBytes.toByteArray());
} catch (IOException | RocksDBException e) {
Throwables.propagate(e);
}
return value;
}
代码示例来源:origin: apsaltis/StreamingData-Book-Examples
static void moveToFailed(final String eventKey) {
try {
final byte[] keyBytes = eventKey.getBytes(StandardCharsets.UTF_8);
final byte[] eventBody = transientStateDB.get(keyBytes);
if(null != eventBody) {
failedStateDB.put(keyBytes, eventBody);
//now remove it from the transient
try {
transientStateDB.remove(keyBytes);
} catch (Exception ex) {
//we should at least log this....
}
}
} catch (Exception ex) {
//this should be logged and perhaps throw
}
}
代码示例来源:origin: org.locationtech.geogig/geogig-rocksdb
@Override
public void removeBlob(String namespace, String path) {
try (RocksDBReference dbRef = db()) {
dbRef.db().remove(key(namespace, path));
} catch (RocksDBException e) {
throw Throwables.propagate(e);
}
}
代码示例来源:origin: org.locationtech.geogig/geogig-rocksdb
@Override
public void delete(ObjectId objectId) {
checkNotNull(objectId, "argument objectId is null");
checkWritable();
byte[] key = objectId.getRawValue();
try (RocksDBReference dbRef = dbhandle.getReference()) {
dbRef.db().remove(key);
} catch (RocksDBException e) {
throw Throwables.propagate(e);
}
}
代码示例来源:origin: org.jsimpledb/jsimpledb-kv-rocksdb
@Override
public void remove(byte[] key) {
key.getClass();
Preconditions.checkState(!this.closed, "closed");
this.cursorTracker.poll();
if (this.writeBatch != null) {
assert RocksDBUtil.isInitialized(this.writeBatch);
synchronized (this.writeBatch) {
this.writeBatch.remove(key);
}
} else {
assert RocksDBUtil.isInitialized(this.db);
try {
this.db.remove(key);
} catch (RocksDBException e) {
throw new RuntimeException("RocksDB error", e);
}
}
}
代码示例来源:origin: org.locationtech.geogig/geogig-rocksdb
@Override
public void removeBlobs(String namespace) {
byte[] namespacePrefix = (namespace + ".").getBytes();
try (RocksDBReference dbRef = db()) {
try (RocksIterator it = dbRef.db().newIterator()) {
it.seek(namespacePrefix);
while (it.isValid()) {
byte[] key = it.key();
for (int i = 0; i < namespacePrefix.length; i++) {
if (namespacePrefix[i] != key[i]) {
return;
}
}
try {
dbRef.db().remove(key);
} catch (RocksDBException e) {
Throwables.propagate(e);
}
it.next();
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!