mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add doc + refactor + fix formatting
This commit is contained in:
@@ -7,70 +7,70 @@ package org.rocksdb;
|
||||
|
||||
public class Iterator {
|
||||
private long nativeHandle_;
|
||||
|
||||
|
||||
public Iterator(long nativeHandle) {
|
||||
nativeHandle_ = nativeHandle;
|
||||
}
|
||||
|
||||
|
||||
public boolean isValid() {
|
||||
assert(isInitialized());
|
||||
return isValid0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public void seekToFirst() {
|
||||
assert(isInitialized());
|
||||
seekToFirst0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public void seekToLast() {
|
||||
assert(isInitialized());
|
||||
seekToLast0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public void next() {
|
||||
assert(isInitialized());
|
||||
next0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public void prev() {
|
||||
assert(isInitialized());
|
||||
prev0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public byte[] key() {
|
||||
assert(isInitialized());
|
||||
return key0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public byte[] value() {
|
||||
assert(isInitialized());
|
||||
return value0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public void seek(byte[] target) {
|
||||
assert(isInitialized());
|
||||
seek0(nativeHandle_, target, target.length);
|
||||
}
|
||||
|
||||
|
||||
public void status(){
|
||||
assert(isInitialized());
|
||||
status0(nativeHandle_);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void close() {
|
||||
if(nativeHandle_ != 0) {
|
||||
close0(nativeHandle_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override protected void finalize() {
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
private boolean isInitialized() {
|
||||
return (nativeHandle_ != 0);
|
||||
}
|
||||
|
||||
|
||||
private native boolean isValid0(long handle);
|
||||
private native void close0(long handle);
|
||||
private native void seekToFirst0(long handle);
|
||||
@@ -81,4 +81,4 @@ public class Iterator {
|
||||
private native byte[] value0(long handle);
|
||||
private native void seek0(long handle, byte[] target, int targetLen);
|
||||
private native void status0(long handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ public class Options {
|
||||
return maxBackgroundCompactions(nativeHandle_);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Creates statistics object which collects metrics about database operations.
|
||||
Statistics objects should not be shared between DB instances as
|
||||
it does not use any locks to prevent concurrent updates.
|
||||
|
||||
@@ -135,7 +135,7 @@ public class RocksDB {
|
||||
throws RocksDBException {
|
||||
remove(nativeHandle_, writeOpt.nativeHandle_, key, key.length);
|
||||
}
|
||||
|
||||
|
||||
public Iterator iterator() {
|
||||
return new Iterator(iterator0(nativeHandle_));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user