public class RocksDB extends RocksObject
Modifier and Type | Class and Description |
---|---|
static class |
RocksDB.CountAndSize |
static class |
RocksDB.LiveFiles |
static class |
RocksDB.Version |
Modifier and Type | Field and Description |
---|---|
static byte[] |
DEFAULT_COLUMN_FAMILY |
static int |
NOT_FOUND |
protected DBOptionsInterface<?> |
options_ |
nativeHandle_
owningHandle_
Modifier | Constructor and Description |
---|---|
protected |
RocksDB(long nativeHandle)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelAllBackgroundWork(boolean wait)
This function will cancel all currently running background processes.
|
void |
clipColumnFamily(ColumnFamilyHandle columnFamilyHandle,
byte[] beginKey,
byte[] endKey)
ClipColumnFamily() will clip the entries in the CF according to the range
[begin_key, end_key).
|
void |
close()
This is similar to
closeE() except that it
silently ignores any errors. |
void |
closeE()
This is similar to
close() except that it
throws an exception if any error occurs. |
java.util.List<java.lang.String> |
compactFiles(CompactionOptions compactionOptions,
ColumnFamilyHandle columnFamilyHandle,
java.util.List<java.lang.String> inputFileNames,
int outputLevel,
int outputPathId,
CompactionJobInfo compactionJobInfo)
Takes a list of files specified by file names and
compacts them to the specified level.
|
java.util.List<java.lang.String> |
compactFiles(CompactionOptions compactionOptions,
java.util.List<java.lang.String> inputFileNames,
int outputLevel,
int outputPathId,
CompactionJobInfo compactionJobInfo)
Takes a list of files specified by file names and
compacts them to the specified level.
|
void |
compactRange()
Range compaction of database.
|
void |
compactRange(byte[] begin,
byte[] end)
Range compaction of database.
|
void |
compactRange(ColumnFamilyHandle columnFamilyHandle)
Range compaction of column family.
|
void |
compactRange(ColumnFamilyHandle columnFamilyHandle,
byte[] begin,
byte[] end)
Range compaction of column family.
|
void |
compactRange(ColumnFamilyHandle columnFamilyHandle,
byte[] begin,
byte[] end,
CompactRangeOptions compactRangeOptions)
Range compaction of column family.
|
void |
continueBackgroundWork()
Resumes background work which was suspended by
previously calling
pauseBackgroundWork() |
java.util.List<ColumnFamilyHandle> |
createColumnFamilies(ColumnFamilyOptions columnFamilyOptions,
java.util.List<byte[]> columnFamilyNames)
Bulk create column families with the same column family options.
|
java.util.List<ColumnFamilyHandle> |
createColumnFamilies(java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors)
Bulk create column families with the same column family options.
|
ColumnFamilyHandle |
createColumnFamily(ColumnFamilyDescriptor columnFamilyDescriptor)
Creates a new column family with the name columnFamilyName and
allocates a ColumnFamilyHandle within an internal structure.
|
ColumnFamilyHandle |
createColumnFamilyWithImport(ColumnFamilyDescriptor columnFamilyDescriptor,
ImportColumnFamilyOptions importColumnFamilyOptions,
ExportImportFilesMetaData metadata)
Creates a new column family with the name columnFamilyName and
import external SST files specified in `metadata` allocates a
ColumnFamilyHandle within an internal structure.
|
ColumnFamilyHandle |
createColumnFamilyWithImport(ColumnFamilyDescriptor columnFamilyDescriptor,
ImportColumnFamilyOptions importColumnFamilyOptions,
java.util.List<ExportImportFilesMetaData> metadatas) |
void |
delete(byte[] key)
Delete the database entry (if any) for "key".
|
void |
delete(byte[] key,
int offset,
int len)
Delete the database entry (if any) for "key".
|
void |
delete(ColumnFamilyHandle columnFamilyHandle,
byte[] key)
Delete the database entry (if any) for "key".
|
void |
delete(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len)
Delete the database entry (if any) for "key".
|
void |
delete(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpt,
byte[] key)
Delete the database entry (if any) for "key".
|
void |
delete(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpt,
byte[] key,
int offset,
int len)
Delete the database entry (if any) for "key".
|
void |
delete(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpt,
java.nio.ByteBuffer key)
Delete the database entry (if any) for "key".
|
void |
delete(WriteOptions writeOpt,
byte[] key)
Delete the database entry (if any) for "key".
|
void |
delete(WriteOptions writeOpt,
byte[] key,
int offset,
int len)
Delete the database entry (if any) for "key".
|
void |
delete(WriteOptions writeOpt,
java.nio.ByteBuffer key)
Delete the database entry (if any) for "key".
|
void |
deleteFile(java.lang.String name)
Delete the file name from the db directory and update the internal state to
reflect that.
|
void |
deleteFilesInRanges(ColumnFamilyHandle columnFamily,
java.util.List<byte[]> ranges,
boolean includeEnd)
Delete files in multiple ranges at once.
|
void |
deleteRange(byte[] beginKey,
byte[] endKey)
Removes the database entries in the range ["beginKey", "endKey"), i.e.,
including "beginKey" and excluding "endKey".
|
void |
deleteRange(ColumnFamilyHandle columnFamilyHandle,
byte[] beginKey,
byte[] endKey)
Removes the database entries in the range ["beginKey", "endKey"), i.e.,
including "beginKey" and excluding "endKey".
|
void |
deleteRange(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpt,
byte[] beginKey,
byte[] endKey)
Removes the database entries in the range ["beginKey", "endKey"), i.e.,
including "beginKey" and excluding "endKey".
|
void |
deleteRange(WriteOptions writeOpt,
byte[] beginKey,
byte[] endKey)
Removes the database entries in the range ["beginKey", "endKey"), i.e.,
including "beginKey" and excluding "endKey".
|
void |
destroyColumnFamilyHandle(ColumnFamilyHandle columnFamilyHandle)
Deletes native column family handle of given
ColumnFamilyHandle Java object
and removes reference from ownedColumnFamilyHandles . |
static void |
destroyDB(java.lang.String path,
Options options)
Static method to destroy the contents of the specified database.
|
void |
disableFileDeletions()
Prevent file deletions.
|
protected void |
disposeInternal(long handle) |
void |
dropColumnFamilies(java.util.List<ColumnFamilyHandle> columnFamilies) |
void |
dropColumnFamily(ColumnFamilyHandle columnFamilyHandle)
Drops the column family specified by
columnFamilyHandle . |
void |
enableAutoCompaction(java.util.List<ColumnFamilyHandle> columnFamilyHandles)
Enable automatic compactions for the given column
families if they were previously disabled.
|
void |
enableFileDeletions()
EnableFileDeletions will only enable file deletion after
it's been called at least as many times as DisableFileDeletions(),
enabling the two methods to be called by two threads concurrently
without synchronization
-- i.e., file deletions will be enabled only after both
threads call EnableFileDeletions()
|
void |
endTrace()
Stop tracing DB operations.
|
void |
flush(FlushOptions flushOptions)
Flush all memory table data.
|
void |
flush(FlushOptions flushOptions,
ColumnFamilyHandle columnFamilyHandle)
Flush all memory table data.
|
void |
flush(FlushOptions flushOptions,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
Flushes multiple column families.
|
void |
flushWal(boolean sync)
Flush the WAL memory buffer to the file.
|
byte[] |
get(byte[] key)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(byte[] key,
byte[] value)
Get the value associated with the specified key within column family*
|
byte[] |
get(byte[] key,
int offset,
int len)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Get the value associated with the specified key within column family*
|
byte[] |
get(ColumnFamilyHandle columnFamilyHandle,
byte[] key)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
byte[] value)
Get the value associated with the specified key within column family.
|
byte[] |
get(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Get the value associated with the specified key within column family.
|
byte[] |
get(ColumnFamilyHandle columnFamilyHandle,
ReadOptions opt,
byte[] key)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ColumnFamilyHandle columnFamilyHandle,
ReadOptions opt,
byte[] key,
byte[] value)
Get the value associated with the specified key within column family.
|
byte[] |
get(ColumnFamilyHandle columnFamilyHandle,
ReadOptions opt,
byte[] key,
int offset,
int len)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ColumnFamilyHandle columnFamilyHandle,
ReadOptions opt,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Get the value associated with the specified key within column family.
|
int |
get(ColumnFamilyHandle columnFamilyHandle,
ReadOptions opt,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
Get the value associated with the specified key within column family.
|
byte[] |
get(ReadOptions opt,
byte[] key)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ReadOptions opt,
byte[] key,
byte[] value)
Get the value associated with the specified key.
|
byte[] |
get(ReadOptions opt,
byte[] key,
int offset,
int len)
The simplified version of get which returns a new byte array storing
the value associated with the specified input key if any.
|
int |
get(ReadOptions opt,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Get the value associated with the specified key.
|
int |
get(ReadOptions opt,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
Get the value associated with the specified key within column family.
|
long |
getAggregatedLongProperty(java.lang.String property)
Return sum of the getLongProperty of all the column families
|
RocksDB.CountAndSize |
getApproximateMemTableStats(ColumnFamilyHandle columnFamilyHandle,
Range range)
This method is similar to
getApproximateSizes(ColumnFamilyHandle, List, SizeApproximationFlag...) ,
except that it returns approximate number of records and size in memtables. |
RocksDB.CountAndSize |
getApproximateMemTableStats(Range range)
This method is similar to
getApproximateSizes(ColumnFamilyHandle, List, SizeApproximationFlag...) ,
except that it returns approximate number of records and size in memtables. |
long[] |
getApproximateSizes(ColumnFamilyHandle columnFamilyHandle,
java.util.List<Range> ranges,
SizeApproximationFlag... sizeApproximationFlags)
Get the approximate file system space used by keys in each range.
|
long[] |
getApproximateSizes(java.util.List<Range> ranges,
SizeApproximationFlag... sizeApproximationFlags)
Get the approximate file system space used by keys in each range for
the default column family.
|
ColumnFamilyMetaData |
getColumnFamilyMetaData()
Obtains the meta data of the default column family of the DB.
|
ColumnFamilyMetaData |
getColumnFamilyMetaData(ColumnFamilyHandle columnFamilyHandle)
Obtains the meta data of the specified column family of the DB.
|
MutableDBOptions.MutableDBOptionsBuilder |
getDBOptions()
Get the database options
|
ColumnFamilyHandle |
getDefaultColumnFamily()
Gets the handle for the default column family
|
Env |
getEnv()
Get the Env object from the DB
|
long |
getLatestSequenceNumber()
The sequence number of the most recent transaction.
|
RocksDB.LiveFiles |
getLiveFiles()
Retrieve the list of all files in the database after flushing the memtable.
|
RocksDB.LiveFiles |
getLiveFiles(boolean flushMemtable)
Retrieve the list of all files in the database.
|
java.util.List<LiveFileMetaData> |
getLiveFilesMetaData()
Gets a list of all table files metadata.
|
long |
getLongProperty(ColumnFamilyHandle columnFamilyHandle,
java.lang.String property)
Similar to GetProperty(), but only works for a subset of properties
whose return value is a numerical value.
|
long |
getLongProperty(java.lang.String property)
Similar to GetProperty(), but only works for a subset of properties
whose return value is a numerical value.
|
java.util.Map<java.lang.String,java.lang.String> |
getMapProperty(ColumnFamilyHandle columnFamilyHandle,
java.lang.String property)
Gets a property map.
|
java.util.Map<java.lang.String,java.lang.String> |
getMapProperty(java.lang.String property)
Gets a property map.
|
java.lang.String |
getName()
Get DB name -- the exact same name that was provided as an argument to
as path to
open(Options, String) . |
MutableColumnFamilyOptions.MutableColumnFamilyOptionsBuilder |
getOptions()
Default column family options
|
MutableColumnFamilyOptions.MutableColumnFamilyOptionsBuilder |
getOptions(ColumnFamilyHandle columnFamilyHandle)
Get the options for the column family handle
|
PerfContext |
getPerfContext()
Return perf context bound to this thread.
|
PerfLevel |
getPerfLevel()
Return current performance level measurement settings.
|
java.util.Map<java.lang.String,TableProperties> |
getPropertiesOfAllTables()
Get the properties of all tables in the default column family.
|
java.util.Map<java.lang.String,TableProperties> |
getPropertiesOfAllTables(ColumnFamilyHandle columnFamilyHandle)
Get the properties of all tables.
|
java.util.Map<java.lang.String,TableProperties> |
getPropertiesOfTablesInRange(ColumnFamilyHandle columnFamilyHandle,
java.util.List<Range> ranges)
Get the properties of tables in range.
|
java.util.Map<java.lang.String,TableProperties> |
getPropertiesOfTablesInRange(java.util.List<Range> ranges)
Get the properties of tables in range for the default column family.
|
java.lang.String |
getProperty(ColumnFamilyHandle columnFamilyHandle,
java.lang.String property)
DB implements can export properties about their state
via this method on a per column family level.
|
java.lang.String |
getProperty(java.lang.String property)
DB implementations can export properties about their state
via this method.
|
Snapshot |
getSnapshot()
Return a handle to the current DB state.
|
java.util.List<LogFile> |
getSortedWalFiles()
Retrieve the sorted list of all wal files with earliest file first.
|
TransactionLogIterator |
getUpdatesSince(long sequenceNumber)
Returns an iterator that is positioned at a write-batch containing
seq_number.
|
void |
ingestExternalFile(ColumnFamilyHandle columnFamilyHandle,
java.util.List<java.lang.String> filePathList,
IngestExternalFileOptions ingestExternalFileOptions)
ingestExternalFile will load a list of external SST files (1) into the DB
We will try to find the lowest possible level that the file can fit in, and
ingest the file into this level (2).
|
void |
ingestExternalFile(java.util.List<java.lang.String> filePathList,
IngestExternalFileOptions ingestExternalFileOptions)
ingestExternalFile will load a list of external SST files (1) into the DB
We will try to find the lowest possible level that the file can fit in, and
ingest the file into this level (2).
|
boolean |
isClosed() |
boolean |
keyExists(byte[] key)
Check if a key exists in the database.
|
boolean |
keyExists(byte[] key,
int offset,
int len)
Check if a key exists in the database.
|
boolean |
keyExists(java.nio.ByteBuffer key)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
byte[] key)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
java.nio.ByteBuffer key)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
byte[] key)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
byte[] key,
int offset,
int len)
Check if a key exists in the database.
|
boolean |
keyExists(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
java.nio.ByteBuffer key)
Check if a key exists in the database.
|
boolean |
keyExists(ReadOptions readOptions,
byte[] key)
Check if a key exists in the database.
|
boolean |
keyExists(ReadOptions readOptions,
byte[] key,
int offset,
int len)
Check if a key exists in the database.
|
boolean |
keyExists(ReadOptions readOptions,
java.nio.ByteBuffer key)
Check if a key exists in the database.
|
boolean |
keyMayExist(byte[] key,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(byte[] key,
int offset,
int len,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(java.nio.ByteBuffer key)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
KeyMayExist |
keyMayExist(java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
If the key definitely does not exist in the database, then this method
returns
KeyMayExist.KeyMayExistEnum.kNotExist ,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue . |
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
java.nio.ByteBuffer key)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
KeyMayExist |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
If the key definitely does not exist in the database, then this method
returns
KeyMayExist.KeyMayExistEnum.kNotExist ,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue . |
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
byte[] key,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
byte[] key,
int offset,
int len,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
java.nio.ByteBuffer key)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
KeyMayExist |
keyMayExist(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
If the key definitely does not exist in the database, then this method
returns
KeyMayExist.KeyMayExistEnum.kNotExist ,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue . |
boolean |
keyMayExist(ReadOptions readOptions,
byte[] key,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ReadOptions readOptions,
byte[] key,
int offset,
int len,
Holder<byte[]> valueHolder)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
boolean |
keyMayExist(ReadOptions readOptions,
java.nio.ByteBuffer key)
If the key definitely does not exist in the database, then this method
returns false, otherwise it returns true if the key might exist.
|
KeyMayExist |
keyMayExist(ReadOptions readOptions,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
If the key definitely does not exist in the database, then this method
returns
KeyMayExist.KeyMayExistEnum.kNotExist ,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue . |
int |
level0StopWriteTrigger()
Number of files in level-0 that would stop writes.
|
int |
level0StopWriteTrigger(ColumnFamilyHandle columnFamilyHandle)
Number of files in level-0 that would stop writes.
|
static java.util.List<byte[]> |
listColumnFamilies(Options options,
java.lang.String path)
Static method to determine all available column families for a
rocksdb database identified by path
|
static void |
loadLibrary()
Loads the necessary library files.
|
static void |
loadLibrary(java.util.List<java.lang.String> paths)
Tries to load the necessary library files from the given list of
directories.
|
protected ColumnFamilyHandle |
makeDefaultColumnFamilyHandle()
Create a handle for the default CF on open
|
int |
maxMemCompactionLevel()
Maximum level to which a new compacted memtable is pushed if it
does not create overlap.
|
int |
maxMemCompactionLevel(ColumnFamilyHandle columnFamilyHandle)
Maximum level to which a new compacted memtable is pushed if it
does not create overlap.
|
void |
merge(byte[] key,
byte[] value)
Add merge operand for key/value pair.
|
void |
merge(byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Add merge operand for key/value pair.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
byte[] value)
Add merge operand for key/value pair in a ColumnFamily.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Add merge operand for key/value pair in a ColumnFamily.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
byte[] key,
byte[] value)
Add merge operand for key/value pair.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Add merge operand for key/value pair.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value) |
void |
merge(WriteOptions writeOpts,
byte[] key,
byte[] value)
Add merge operand for key/value pair.
|
void |
merge(WriteOptions writeOpts,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Add merge operand for key/value pair.
|
void |
merge(WriteOptions writeOpts,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value) |
java.util.List<byte[]> |
multiGetAsList(java.util.List<byte[]> keys)
Takes a list of keys, and returns a list of values for the given list of
keys.
|
java.util.List<byte[]> |
multiGetAsList(java.util.List<ColumnFamilyHandle> columnFamilyHandleList,
java.util.List<byte[]> keys)
Returns a list of values for the given list of keys.
|
java.util.List<byte[]> |
multiGetAsList(ReadOptions opt,
java.util.List<byte[]> keys)
Returns a list of values for the given list of keys.
|
java.util.List<byte[]> |
multiGetAsList(ReadOptions opt,
java.util.List<ColumnFamilyHandle> columnFamilyHandleList,
java.util.List<byte[]> keys)
Returns a list of values for the given list of keys.
|
java.util.List<ByteBufferGetStatus> |
multiGetByteBuffers(java.util.List<java.nio.ByteBuffer> keys,
java.util.List<java.nio.ByteBuffer> values)
Fetches a list of values for the given list of keys, all from the default column family.
|
java.util.List<ByteBufferGetStatus> |
multiGetByteBuffers(java.util.List<ColumnFamilyHandle> columnFamilyHandleList,
java.util.List<java.nio.ByteBuffer> keys,
java.util.List<java.nio.ByteBuffer> values)
Fetches a list of values for the given list of keys.
|
java.util.List<ByteBufferGetStatus> |
multiGetByteBuffers(ReadOptions readOptions,
java.util.List<java.nio.ByteBuffer> keys,
java.util.List<java.nio.ByteBuffer> values)
Fetches a list of values for the given list of keys, all from the default column family.
|
java.util.List<ByteBufferGetStatus> |
multiGetByteBuffers(ReadOptions readOptions,
java.util.List<ColumnFamilyHandle> columnFamilyHandleList,
java.util.List<java.nio.ByteBuffer> keys,
java.util.List<java.nio.ByteBuffer> values)
Fetches a list of values for the given list of keys.
|
RocksIterator |
newIterator()
Return a heap-allocated iterator over the contents of the
database.
|
RocksIterator |
newIterator(ColumnFamilyHandle columnFamilyHandle)
Return a heap-allocated iterator over the contents of a
ColumnFamily.
|
RocksIterator |
newIterator(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions)
Return a heap-allocated iterator over the contents of a
ColumnFamily.
|
RocksIterator |
newIterator(ReadOptions readOptions)
Return a heap-allocated iterator over the contents of the
database.
|
java.util.List<RocksIterator> |
newIterators(java.util.List<ColumnFamilyHandle> columnFamilyHandleList)
Returns iterators from a consistent database state across multiple
column families.
|
java.util.List<RocksIterator> |
newIterators(java.util.List<ColumnFamilyHandle> columnFamilyHandleList,
ReadOptions readOptions)
Returns iterators from a consistent database state across multiple
column families.
|
int |
numberLevels()
Number of levels used for this DB.
|
int |
numberLevels(ColumnFamilyHandle columnFamilyHandle)
Number of levels used for a column family in this DB.
|
static RocksDB |
open(DBOptions options,
java.lang.String path,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
The factory constructor of RocksDB that opens a RocksDB instance given
the path to the database using the specified options and db path and a list
of column family names.
|
static RocksDB |
open(Options options,
java.lang.String path)
The factory constructor of RocksDB that opens a RocksDB instance given
the path to the database using the specified options and db path.
|
static RocksDB |
open(java.lang.String path)
The factory constructor of RocksDB that opens a RocksDB instance given
the path to the database using the default options w/ createIfMissing
set to true.
|
static RocksDB |
open(java.lang.String path,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
The factory constructor of RocksDB that opens a RocksDB instance given
the path to the database using the specified options and db path and a list
of column family names.
|
static RocksDB |
openAsSecondary(DBOptions options,
java.lang.String path,
java.lang.String secondaryPath,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
Open DB as secondary instance with column families.
|
static RocksDB |
openAsSecondary(Options options,
java.lang.String path,
java.lang.String secondaryPath)
Open DB as secondary instance with only the default column family.
|
static RocksDB |
openReadOnly(DBOptions options,
java.lang.String path,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the specified
options and db path.
|
static RocksDB |
openReadOnly(DBOptions options,
java.lang.String path,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles,
boolean errorIfWalFileExists)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the specified
options and db path.
|
static RocksDB |
openReadOnly(Options options,
java.lang.String path)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the specified
options and db path.
|
static RocksDB |
openReadOnly(Options options,
java.lang.String path,
boolean errorIfWalFileExists)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the specified
options and db path.
|
static RocksDB |
openReadOnly(java.lang.String path)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the default
options.
|
static RocksDB |
openReadOnly(java.lang.String path,
java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors,
java.util.List<ColumnFamilyHandle> columnFamilyHandles)
The factory constructor of RocksDB that opens a RocksDB instance in
Read-Only mode given the path to the database using the default
options.
|
void |
pauseBackgroundWork()
This function will wait until all currently running background processes
finish.
|
void |
promoteL0(ColumnFamilyHandle columnFamilyHandle,
int targetLevel)
Promote L0.
|
void |
promoteL0(int targetLevel)
Promote L0 for the default column family.
|
void |
put(byte[] key,
byte[] value)
Set the database entry for "key" to "value".
|
void |
put(byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Set the database entry for "key" to "value".
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
byte[] value)
Set the database entry for "key" to "value" in the specified
column family.
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Set the database entry for "key" to "value" in the specified
column family.
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
byte[] key,
byte[] value)
Set the database entry for "key" to "value" for the specified
column family.
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Set the database entry for "key" to "value" for the specified
column family.
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
Set the database entry for "key" to "value" for the specified
column family.
|
void |
put(WriteOptions writeOpts,
byte[] key,
byte[] value)
Set the database entry for "key" to "value".
|
void |
put(WriteOptions writeOpts,
byte[] key,
int offset,
int len,
byte[] value,
int vOffset,
int vLen)
Set the database entry for "key" to "value".
|
void |
put(WriteOptions writeOpts,
java.nio.ByteBuffer key,
java.nio.ByteBuffer value)
Set the database entry for "key" to "value".
|
void |
releaseSnapshot(Snapshot snapshot)
Release a previously acquired snapshot.
|
void |
resetStats()
Reset internal stats for DB and all column families.
|
static RocksDB.Version |
rocksdbVersion() |
void |
setDBOptions(MutableDBOptions mutableDBoptions)
Set the options for the column family handle.
|
void |
setOptions(ColumnFamilyHandle columnFamilyHandle,
MutableColumnFamilyOptions mutableColumnFamilyOptions)
Change the options for the column family handle.
|
void |
setOptions(MutableColumnFamilyOptions mutableColumnFamilyOptions)
Change the options for the default column family handle.
|
void |
setPerfLevel(PerfLevel level)
Set performance level for rocksdb performance measurement.
|
void |
singleDelete(byte[] key)
Remove the database entry for
key . |
void |
singleDelete(ColumnFamilyHandle columnFamilyHandle,
byte[] key)
Remove the database entry for
key . |
void |
singleDelete(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpt,
byte[] key)
Remove the database entry for
key . |
void |
singleDelete(WriteOptions writeOpt,
byte[] key)
Remove the database entry for
key . |
void |
startTrace(TraceOptions traceOptions,
AbstractTraceWriter traceWriter)
Trace DB operations.
|
protected void |
storeDefaultColumnFamilyHandle(ColumnFamilyHandle columnFamilyHandle) |
protected void |
storeOptionsInstance(DBOptionsInterface<?> options) |
Range |
suggestCompactRange()
Suggest the range to compact for the default column family.
|
Range |
suggestCompactRange(ColumnFamilyHandle columnFamilyHandle)
Suggest the range to compact.
|
void |
syncWal()
Sync the WAL.
|
void |
tryCatchUpWithPrimary()
Make the secondary instance catch up with the primary by tailing and
replaying the MANIFEST and WAL of the primary.
|
void |
verifyChecksum()
Verify checksum
|
void |
write(WriteOptions writeOpts,
WriteBatch updates)
Apply the specified updates to the database.
|
void |
write(WriteOptions writeOpts,
WriteBatchWithIndex updates)
Apply the specified updates to the database.
|
disposeInternal, getNativeHandle
disOwnNativeHandle, isOwningHandle
public static final byte[] DEFAULT_COLUMN_FAMILY
public static final int NOT_FOUND
protected DBOptionsInterface<?> options_
protected RocksDB(long nativeHandle)
nativeHandle
- The native handle of the C++ RocksDB objectpublic static void loadLibrary()
public static void loadLibrary(java.util.List<java.lang.String> paths)
paths
- a list of strings where each describes a directory
of a library.public static RocksDB.Version rocksdbVersion()
public boolean isClosed()
public static RocksDB open(java.lang.String path) throws RocksDBException
path
- the path to the rocksdb.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.Options.setCreateIfMissing(boolean)
public static RocksDB open(java.lang.String path, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
If opened in read write mode every existing column family name must be passed within the list to this method.
If opened in read-only mode only a subset of existing column families must be passed to this method.
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly, then this options instance will be GC'd automatically
ColumnFamily handles are disposed when the RocksDB instance is disposed.
path
- the path to the rocksdb.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.DBOptions.setCreateIfMissing(boolean)
public static RocksDB open(Options options, java.lang.String path) throws RocksDBException
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly, then this options instance will be GC'd automatically.
Options instance can be re-used to open multiple DBs if DB statistics is not used. If DB statistics are required, then its recommended to open DB with new Options instance as underlying native statistics instance does not use any locks to prevent concurrent updates.
options
- Options
instance.path
- the path to the rocksdb.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.Options.setCreateIfMissing(boolean)
public static RocksDB open(DBOptions options, java.lang.String path, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
If opened in read write mode every existing column family name must be passed within the list to this method.
If opened in read-only mode only a subset of existing column families must be passed to this method.
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly, then this options instance will be GC'd automatically.
Options instance can be re-used to open multiple DBs if DB statistics is not used. If DB statistics are required, then its recommended to open DB with new Options instance as underlying native statistics instance does not use any locks to prevent concurrent updates.
ColumnFamily handles are disposed when the RocksDB instance is disposed.
options
- DBOptions
instance.path
- the path to the rocksdb.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.DBOptions.setCreateIfMissing(boolean)
public static RocksDB openReadOnly(java.lang.String path) throws RocksDBException
path
- the path to the RocksDB.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openReadOnly(Options options, java.lang.String path) throws RocksDBException
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly, then this options instance will be GC'd automatically.
options
- Options
instance.path
- the path to the RocksDB.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openReadOnly(Options options, java.lang.String path, boolean errorIfWalFileExists) throws RocksDBException
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly, then this options instance will be GC'd automatically.
options
- Options
instance.path
- the path to the RocksDB.errorIfWalFileExists
- true to raise an error when opening the db
if a Write Ahead Log file exists, false otherwise.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openReadOnly(java.lang.String path, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
path
- the path to the RocksDB.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openReadOnly(DBOptions options, java.lang.String path, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
This open method allows to open RocksDB using a subset of available column families
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly,then this options instance will be GC'd automatically.
options
- DBOptions
instance.path
- the path to the RocksDB.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openReadOnly(DBOptions options, java.lang.String path, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles, boolean errorIfWalFileExists) throws RocksDBException
This open method allows to open RocksDB using a subset of available column families
Options instance *should* not be disposed before all DBs using this options instance have been closed. If user doesn't call options dispose explicitly,then this options instance will be GC'd automatically.
options
- DBOptions
instance.path
- the path to the RocksDB.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.errorIfWalFileExists
- true to raise an error when opening the db
if a Write Ahead Log file exists, false otherwise.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openAsSecondary(Options options, java.lang.String path, java.lang.String secondaryPath) throws RocksDBException
The secondary instance can dynamically tail the MANIFEST of
a primary that must have already been created. User can call
tryCatchUpWithPrimary()
to make the secondary instance catch up
with primary (WAL tailing is NOT supported now) whenever the user feels
necessary. Column families created by the primary after the secondary
instance starts are currently ignored by the secondary instance.
Column families opened by secondary and dropped by the primary will be
dropped by secondary as well. However the user of the secondary instance
can still access the data of such dropped column family as long as they
do not destroy the corresponding column family handle.
WAL tailing is not supported at present, but will arrive soon.
options
- the options to open the secondary instance.path
- the path to the primary RocksDB instance.secondaryPath
- points to a directory where the secondary instance
stores its info logRocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public static RocksDB openAsSecondary(DBOptions options, java.lang.String path, java.lang.String secondaryPath, java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
The secondary instance can dynamically tail the MANIFEST of
a primary that must have already been created. User can call
tryCatchUpWithPrimary()
to make the secondary instance catch up
with primary (WAL tailing is NOT supported now) whenever the user feels
necessary. Column families created by the primary after the secondary
instance starts are currently ignored by the secondary instance.
Column families opened by secondary and dropped by the primary will be
dropped by secondary as well. However the user of the secondary instance
can still access the data of such dropped column family as long as they
do not destroy the corresponding column family handle.
WAL tailing is not supported at present, but will arrive soon.
options
- the options to open the secondary instance.path
- the path to the primary RocksDB instance.secondaryPath
- points to a directory where the secondary instance
stores its info log.columnFamilyDescriptors
- list of column family descriptorscolumnFamilyHandles
- will be filled with ColumnFamilyHandle instances
on open.RocksDB
instance on success, null if the specified
RocksDB
can not be opened.RocksDBException
- thrown if error happens in underlying
native library.public void closeE() throws RocksDBException
close()
except that it
throws an exception if any error occurs.
This will not fsync the WAL files.
If syncing is required, the caller must first call syncWal()
or write(WriteOptions, WriteBatch)
using an empty write batch
with WriteOptions.setSync(boolean)
set to true.
See also close()
.
RocksDBException
- if an error occurs whilst closing.public void close()
closeE()
except that it
silently ignores any errors.
This will not fsync the WAL files.
If syncing is required, the caller must first call syncWal()
or write(WriteOptions, WriteBatch)
using an empty write batch
with WriteOptions.setSync(boolean)
set to true.
See also close()
.
close
in interface java.lang.AutoCloseable
close
in class AbstractImmutableNativeReference
public static java.util.List<byte[]> listColumnFamilies(Options options, java.lang.String path) throws RocksDBException
options
- Options for opening the databasepath
- Absolute path to rocksdb databaseRocksDBException
- thrown if error happens in underlying
native library.public ColumnFamilyHandle createColumnFamily(ColumnFamilyDescriptor columnFamilyDescriptor) throws RocksDBException
columnFamilyDescriptor
- column family to be created.ColumnFamilyHandle
instance.RocksDBException
- thrown if error happens in underlying
native library.public java.util.List<ColumnFamilyHandle> createColumnFamilies(ColumnFamilyOptions columnFamilyOptions, java.util.List<byte[]> columnFamilyNames) throws RocksDBException
columnFamilyOptions
- the options for the column families.columnFamilyNames
- the names of the column families.RocksDBException
- if an error occurs whilst creating
the column familiespublic java.util.List<ColumnFamilyHandle> createColumnFamilies(java.util.List<ColumnFamilyDescriptor> columnFamilyDescriptors) throws RocksDBException
columnFamilyDescriptors
- the descriptions of the column families.RocksDBException
- if an error occurs whilst creating
the column familiespublic ColumnFamilyHandle createColumnFamilyWithImport(ColumnFamilyDescriptor columnFamilyDescriptor, ImportColumnFamilyOptions importColumnFamilyOptions, ExportImportFilesMetaData metadata) throws RocksDBException
columnFamilyDescriptor
- column family to be created.ColumnFamilyHandle
instance.RocksDBException
- thrown if error happens in underlying
native library.public ColumnFamilyHandle createColumnFamilyWithImport(ColumnFamilyDescriptor columnFamilyDescriptor, ImportColumnFamilyOptions importColumnFamilyOptions, java.util.List<ExportImportFilesMetaData> metadatas) throws RocksDBException
RocksDBException
public void dropColumnFamily(ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
columnFamilyHandle
. This call
only records a drop record in the manifest and prevents the column
family from flushing and compacting.columnFamilyHandle
- ColumnFamilyHandle
instanceRocksDBException
- thrown if error happens in underlying
native library.public void dropColumnFamilies(java.util.List<ColumnFamilyHandle> columnFamilies) throws RocksDBException
RocksDBException
public void destroyColumnFamilyHandle(ColumnFamilyHandle columnFamilyHandle)
ColumnFamilyHandle
Java object
and removes reference from ownedColumnFamilyHandles
.columnFamilyHandle
- column family handle object.public void put(byte[] key, byte[] value) throws RocksDBException
key
- the specified key to be inserted.value
- the value associated with the specified key.RocksDBException
- thrown if error happens in underlying
native library.public void put(byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
key
- The specified key to be insertedoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value associated with the specified keyvOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if errors happens in underlying native
library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the specified key to be inserted.value
- the value associated with the specified key.
throws IllegalArgumentException if column family is not present
RocksDBException
- thrown if error happens in underlying
native library.public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- The specified key to be insertedoffset
- the offset of the "key" array to be used, must
be non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value associated with the specified keyvOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if errors happens in underlying native
library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void put(WriteOptions writeOpts, byte[] key, byte[] value) throws RocksDBException
writeOpts
- WriteOptions
instance.key
- the specified key to be inserted.value
- the value associated with the specified key.RocksDBException
- thrown if error happens in underlying
native library.public void put(WriteOptions writeOpts, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
writeOpts
- WriteOptions
instance.key
- The specified key to be insertedoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value associated with the specified keyvOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void put(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, byte[] key, byte[] value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpts
- WriteOptions
instance.key
- the specified key to be inserted.value
- the value associated with the specified key.
throws IllegalArgumentException if column family is not present
RocksDBException
- thrown if error happens in underlying
native library.IllegalArgumentException
public void put(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpts
- WriteOptions
instance.key
- the specified key to be inserted. Position and limit is used.
Supports direct buffer only.value
- the value associated with the specified key. Position and limit is used.
Supports direct buffer only.
throws IllegalArgumentException if column family is not present
RocksDBException
- thrown if error happens in underlying
native library.IllegalArgumentException
public void put(WriteOptions writeOpts, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
writeOpts
- WriteOptions
instance.key
- the specified key to be inserted. Position and limit is used.
Supports direct buffer only.value
- the value associated with the specified key. Position and limit is used.
Supports direct buffer only.
throws IllegalArgumentException if column family is not present
RocksDBException
- thrown if error happens in underlying
native library.IllegalArgumentException
public void put(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpts
- WriteOptions
instance.key
- The specified key to be insertedoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value associated with the specified keyvOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void delete(byte[] key) throws RocksDBException
key
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.public void delete(byte[] key, int offset, int len) throws RocksDBException
key
- Key to delete within databaseoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be
non-negative and no larger than ("key".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public void delete(ColumnFamilyHandle columnFamilyHandle, byte[] key) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.public void delete(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- Key to delete within databaseoffset
- the offset of the "key" array to be used,
must be non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public void delete(WriteOptions writeOpt, byte[] key) throws RocksDBException
writeOpt
- WriteOptions to be used with delete operationkey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.public void delete(WriteOptions writeOpt, byte[] key, int offset, int len) throws RocksDBException
writeOpt
- WriteOptions to be used with delete operationkey
- Key to delete within databaseoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be
non-negative and no larger than ("key".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public void delete(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt, byte[] key) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpt
- WriteOptions to be used with delete operationkey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.public void delete(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt, byte[] key, int offset, int len) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpt
- WriteOptions to be used with delete operationkey
- Key to delete within databaseoffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be
non-negative and no larger than ("key".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public int get(ReadOptions opt, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
opt
- ReadOptions
instance.key
- the key to retrieve the value. It is using position and limit.
Supports direct buffer only.value
- the out-value to receive the retrieved value.
It is using position and limit. Limit is set according to value size.
Supports direct buffer only.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instanceopt
- ReadOptions
instance.key
- the key to retrieve the value. It is using position and limit.
Supports direct buffer only.value
- the out-value to receive the retrieved value.
It is using position and limit. Limit is set according to value size.
Supports direct buffer only.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.@Experimental(value="Performance optimization for a very specific workload") public void singleDelete(byte[] key) throws RocksDBException
key
. Requires that the key exists
and was not overwritten. It is not an error if the key did not exist
in the database.
If a key is overwritten (by calling put(byte[], byte[])
multiple
times), then the result of calling SingleDelete() on this key is undefined.
SingleDelete() only behaves correctly if there has been only one Put()
for this key since the previous call to SingleDelete() for this key.
This feature is currently an experimental performance optimization for a very specific workload. It is up to the caller to ensure that SingleDelete is only used for a key that is not deleted using Delete() or written using Merge(). Mixing SingleDelete operations with Deletes and Merges can result in undefined behavior.
key
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.@Experimental(value="Performance optimization for a very specific workload") public void singleDelete(ColumnFamilyHandle columnFamilyHandle, byte[] key) throws RocksDBException
key
. Requires that the key exists
and was not overwritten. It is not an error if the key did not exist
in the database.
If a key is overwritten (by calling put(byte[], byte[])
multiple
times), then the result of calling SingleDelete() on this key is undefined.
SingleDelete() only behaves correctly if there has been only one Put()
for this key since the previous call to SingleDelete() for this key.
This feature is currently an experimental performance optimization for a very specific workload. It is up to the caller to ensure that SingleDelete is only used for a key that is not deleted using Delete() or written using Merge(). Mixing SingleDelete operations with Deletes and Merges can result in undefined behavior.
columnFamilyHandle
- The column family to delete the key fromkey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.@Experimental(value="Performance optimization for a very specific workload") public void singleDelete(WriteOptions writeOpt, byte[] key) throws RocksDBException
key
. Requires that the key exists
and was not overwritten. It is not an error if the key did not exist
in the database.
If a key is overwritten (by calling put(byte[], byte[])
multiple
times), then the result of calling SingleDelete() on this key is undefined.
SingleDelete() only behaves correctly if there has been only one Put()
for this key since the previous call to SingleDelete() for this key.
This feature is currently an experimental performance optimization for a very specific workload. It is up to the caller to ensure that SingleDelete is only used for a key that is not deleted using Delete() or written using Merge(). Mixing SingleDelete operations with Deletes and Merges can result in undefined behavior.
Note: consider setting WriteOptions.setSync(boolean)
true.
writeOpt
- Write options for the deletekey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.@Experimental(value="Performance optimization for a very specific workload") public void singleDelete(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt, byte[] key) throws RocksDBException
key
. Requires that the key exists
and was not overwritten. It is not an error if the key did not exist
in the database.
If a key is overwritten (by calling put(byte[], byte[])
multiple
times), then the result of calling SingleDelete() on this key is undefined.
SingleDelete() only behaves correctly if there has been only one Put()
for this key since the previous call to SingleDelete() for this key.
This feature is currently an experimental performance optimization for a very specific workload. It is up to the caller to ensure that SingleDelete is only used for a key that is not deleted using Delete() or written using Merge(). Mixing SingleDelete operations with Deletes and Merges can result in undefined behavior.
Note: consider setting WriteOptions.setSync(boolean)
true.
columnFamilyHandle
- The column family to delete the key fromwriteOpt
- Write options for the deletekey
- Key to delete within databaseRocksDBException
- thrown if error happens in underlying
native library.public void deleteRange(byte[] beginKey, byte[] endKey) throws RocksDBException
Delete 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.
beginKey
- First key to delete within database (inclusive)endKey
- Last key to delete within database (exclusive)RocksDBException
- thrown if error happens in underlying native
library.public void deleteRange(ColumnFamilyHandle columnFamilyHandle, byte[] beginKey, byte[] endKey) throws RocksDBException
Delete 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.
columnFamilyHandle
- ColumnFamilyHandle
instancebeginKey
- First key to delete within database (inclusive)endKey
- Last key to delete within database (exclusive)RocksDBException
- thrown if error happens in underlying native
library.public void deleteRange(WriteOptions writeOpt, byte[] beginKey, byte[] endKey) throws RocksDBException
Delete 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.
writeOpt
- WriteOptions to be used with delete operationbeginKey
- First key to delete within database (inclusive)endKey
- Last key to delete within database (exclusive)RocksDBException
- thrown if error happens in underlying
native library.public void deleteRange(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt, byte[] beginKey, byte[] endKey) throws RocksDBException
Delete 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.
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpt
- WriteOptions to be used with delete operationbeginKey
- First key to delete within database (included)endKey
- Last key to delete within database (excluded)RocksDBException
- thrown if error happens in underlying native
library.public void merge(byte[] key, byte[] value) throws RocksDBException
key
- the specified key to be merged.value
- the value to be merged with the current value for the
specified key.RocksDBException
- thrown if error happens in underlying
native library.public void merge(byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
key
- the specified key to be merged.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value to be merged with the current value for the
specified key.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and must be non-negative and no larger than
("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the specified key to be merged.value
- the value to be merged with the current value for
the specified key.RocksDBException
- thrown if error happens in underlying
native library.public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the specified key to be merged.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value to be merged with the current value for
the specified key.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
must be non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void merge(WriteOptions writeOpts, byte[] key, byte[] value) throws RocksDBException
writeOpts
- WriteOptions
for this write.key
- the specified key to be merged.value
- the value to be merged with the current value for
the specified key.RocksDBException
- thrown if error happens in underlying
native library.public void merge(WriteOptions writeOpts, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
writeOpts
- WriteOptions
for this write.key
- the specified key to be merged.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("value".length - offset)value
- the value to be merged with the current value for
the specified key.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void merge(WriteOptions writeOpts, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
RocksDBException
public void merge(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBException
RocksDBException
public void delete(WriteOptions writeOpt, java.nio.ByteBuffer key) throws RocksDBException
writeOpt
- WriteOptions to be used with delete operationkey
- Key to delete within database. It is using position and limit.
Supports direct buffer only.RocksDBException
- thrown if error happens in underlying
native library.public void delete(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt, java.nio.ByteBuffer key) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpt
- WriteOptions to be used with delete operationkey
- Key to delete within database. It is using position and limit.
Supports direct buffer only.RocksDBException
- thrown if error happens in underlying
native library.public void merge(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, byte[] key, byte[] value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpts
- WriteOptions
for this write.key
- the specified key to be merged.value
- the value to be merged with the current value for the
specified key.RocksDBException
- thrown if error happens in underlying
native library.public void merge(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancewriteOpts
- WriteOptions
for this write.key
- the specified key to be merged.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the value to be merged with the current value for
the specified key.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)RocksDBException
- thrown if error happens in underlying
native library.java.lang.IndexOutOfBoundsException
- if an offset or length is out of boundspublic void write(WriteOptions writeOpts, WriteBatch updates) throws RocksDBException
writeOpts
- WriteOptions instanceupdates
- WriteBatch instanceRocksDBException
- thrown if error happens in underlying
native library.public void write(WriteOptions writeOpts, WriteBatchWithIndex updates) throws RocksDBException
writeOpts
- WriteOptions instanceupdates
- WriteBatchWithIndex instanceRocksDBException
- thrown if error happens in underlying
native library.public int get(byte[] key, byte[] value) throws RocksDBException
key
- the key to retrieve the value.value
- the out-value to receive the retrieved value.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
key
- the key to retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the out-value to receive the retrieved value.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "value".lengthvLen
- the length of the "value" array to be used, must be
non-negative and and no larger than ("value".length - offset)key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) throws RocksDBException, java.lang.IllegalArgumentException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key to retrieve the value.value
- the out-value to receive the retrieved value.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.java.lang.IllegalArgumentException
public int get(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException, java.lang.IllegalArgumentException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key to retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
an no larger than ("key".length - offset)value
- the out-value to receive the retrieved value.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.java.lang.IllegalArgumentException
public int get(ReadOptions opt, byte[] key, byte[] value) throws RocksDBException
opt
- ReadOptions
instance.key
- the key to retrieve the value.value
- the out-value to receive the retrieved value.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(ReadOptions opt, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
opt
- ReadOptions
instance.key
- the key to retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)value
- the out-value to receive the retrieved value.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, must be
non-negative and no larger than ("value".length - offset)key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, byte[] key, byte[] value) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instanceopt
- ReadOptions
instance.key
- the key to retrieve the value.value
- the out-value to receive the retrieved value.key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public int get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, byte[] key, int offset, int len, byte[] value, int vOffset, int vLen) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instanceopt
- ReadOptions
instance.key
- the key to retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be
non-negative and and no larger than ("key".length - offset)value
- the out-value to receive the retrieved value.vOffset
- the offset of the "value" array to be used, must be
non-negative and no longer than "key".lengthvLen
- the length of the "value" array to be used, and must be
non-negative and no larger than ("value".length - offset)key
in byte. If the return value is greater than the
length of value
, then it indicates that the size of the
input buffer value
is insufficient and partial result will
be returned. RocksDB.NOT_FOUND will be returned if the value not
found.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(byte[] key) throws RocksDBException
key
- the key retrieve the value.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(byte[] key, int offset, int len) throws RocksDBException
key
- the key retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ColumnFamilyHandle columnFamilyHandle, byte[] key) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key retrieve the value.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ReadOptions opt, byte[] key) throws RocksDBException
key
- the key retrieve the value.opt
- Read options.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ReadOptions opt, byte[] key, int offset, int len) throws RocksDBException
key
- the key retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)opt
- Read options.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, byte[] key) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key retrieve the value.opt
- Read options.RocksDBException
- thrown if error happens in underlying
native library.public byte[] get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, byte[] key, int offset, int len) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the key retrieve the value.offset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than ("key".length - offset)opt
- Read options.RocksDBException
- thrown if error happens in underlying
native library.public java.util.List<byte[]> multiGetAsList(java.util.List<byte[]> keys) throws RocksDBException
keys
- List of keys for which values need to be retrieved.RocksDBException
- thrown if error happens in underlying
native library.public java.util.List<byte[]> multiGetAsList(java.util.List<ColumnFamilyHandle> columnFamilyHandleList, java.util.List<byte[]> keys) throws RocksDBException, java.lang.IllegalArgumentException
Note: Every key needs to have a related column family name in
columnFamilyHandleList
.
columnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.keys
- List of keys for which values need to be retrieved.RocksDBException
- thrown if error happens in underlying
native library.java.lang.IllegalArgumentException
- thrown if the size of passed keys is not
equal to the amount of passed column family handles.public java.util.List<byte[]> multiGetAsList(ReadOptions opt, java.util.List<byte[]> keys) throws RocksDBException
opt
- Read options.keys
- of keys for which values need to be retrieved.RocksDBException
- thrown if error happens in underlying
native library.public java.util.List<byte[]> multiGetAsList(ReadOptions opt, java.util.List<ColumnFamilyHandle> columnFamilyHandleList, java.util.List<byte[]> keys) throws RocksDBException
Note: Every key needs to have a related column family name in
columnFamilyHandleList
.
opt
- Read options.columnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.keys
- of keys for which values need to be retrieved.RocksDBException
- thrown if error happens in underlying
native library.java.lang.IllegalArgumentException
- thrown if the size of passed keys is not
equal to the amount of passed column family handles.public java.util.List<ByteBufferGetStatus> multiGetByteBuffers(java.util.List<java.nio.ByteBuffer> keys, java.util.List<java.nio.ByteBuffer> values) throws RocksDBException
keys
- list of keys for which values need to be retrieved.values
- list of buffers to return retrieved values inRocksDBException
- if error happens in underlying native library.java.lang.IllegalArgumentException
- thrown if the number of passed keys and passed values
do not match.public java.util.List<ByteBufferGetStatus> multiGetByteBuffers(ReadOptions readOptions, java.util.List<java.nio.ByteBuffer> keys, java.util.List<java.nio.ByteBuffer> values) throws RocksDBException
readOptions
- Read optionskeys
- list of keys for which values need to be retrieved.values
- list of buffers to return retrieved values inRocksDBException
- if error happens in underlying native library.java.lang.IllegalArgumentException
- thrown if the number of passed keys and passed values
do not match.public java.util.List<ByteBufferGetStatus> multiGetByteBuffers(java.util.List<ColumnFamilyHandle> columnFamilyHandleList, java.util.List<java.nio.ByteBuffer> keys, java.util.List<java.nio.ByteBuffer> values) throws RocksDBException
Note: Every key needs to have a related column family name in
columnFamilyHandleList
.
columnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.keys
- list of keys for which values need to be retrieved.values
- list of buffers to return retrieved values inRocksDBException
- if error happens in underlying native library.java.lang.IllegalArgumentException
- thrown if the number of passed keys, passed values and
passed column family handles do not match.public java.util.List<ByteBufferGetStatus> multiGetByteBuffers(ReadOptions readOptions, java.util.List<ColumnFamilyHandle> columnFamilyHandleList, java.util.List<java.nio.ByteBuffer> keys, java.util.List<java.nio.ByteBuffer> values) throws RocksDBException
Note: Every key needs to have a related column family name in
columnFamilyHandleList
.
readOptions
- Read optionscolumnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.keys
- list of keys for which values need to be retrieved.values
- list of buffers to return retrieved values inRocksDBException
- if error happens in underlying native library.java.lang.IllegalArgumentException
- thrown if the number of passed keys, passed values and
passed column family handles do not match.public boolean keyExists(byte[] key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.key
- byte array of a key to search for*public boolean keyExists(byte[] key, int offset, int len)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.key
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthpublic boolean keyExists(ColumnFamilyHandle columnFamilyHandle, byte[] key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancekey
- byte array of a key to search forpublic boolean keyExists(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthpublic boolean keyExists(ReadOptions readOptions, byte[] key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.readOptions
- ReadOptions
instancekey
- byte array of a key to search forpublic boolean keyExists(ReadOptions readOptions, byte[] key, int offset, int len)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.readOptions
- ReadOptions
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthpublic boolean keyExists(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, byte[] key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instancekey
- byte array of a key to search forpublic boolean keyExists(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, byte[] key, int offset, int len)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthpublic boolean keyExists(java.nio.ByteBuffer key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.key
- ByteBuffer with key. Must be allocated as direct.public boolean keyExists(ColumnFamilyHandle columnFamilyHandle, java.nio.ByteBuffer key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancekey
- ByteBuffer with key. Must be allocated as direct.public boolean keyExists(ReadOptions readOptions, java.nio.ByteBuffer key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.readOptions
- ReadOptions
instancekey
- ByteBuffer with key. Must be allocated as direct.public boolean keyExists(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, java.nio.ByteBuffer key)
keyMayExist
but it gives a 100% guarantee
of a correct result, whether the key exists or not.
Internally it checks if the key may exist and then double checks with read operation
that confirms the key exists. This deals with the case where keyMayExist
may return
a false positive.
The code crosses the Java/JNI boundary only once.columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instancekey
- ByteBuffer with key. Must be allocated as direct.public boolean keyMayExist(byte[] key, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(byte[])
. One way to make this lighter weight is to avoid
doing any IOs.
key
- byte array of a key to search forvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(byte[] key, int offset, int len, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(byte[], int, int)
. One way to make this lighter weight is to
avoid doing any IOs.
key
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, byte[] key, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ColumnFamilyHandle,byte[])
. One way to make this lighter
weight is to avoid doing any IOs.
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- byte array of a key to search forvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, byte[] key, int offset, int len, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ColumnFamilyHandle, byte[], int, int)
. One way to make this
lighter weight is to avoid doing any IOs.
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ReadOptions readOptions, byte[] key, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ReadOptions, byte[])
. One way to make this
lighter weight is to avoid doing any IOs.
readOptions
- ReadOptions
instancekey
- byte array of a key to search forvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ReadOptions readOptions, byte[] key, int offset, int len, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ReadOptions, byte[], int, int)
. One way to make this
lighter weight is to avoid doing any IOs.
readOptions
- ReadOptions
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, byte[] key, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ColumnFamilyHandle, ReadOptions, byte[])
. One way to make this
lighter weight is to avoid doing any IOs.
columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instancekey
- byte array of a key to search forvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, byte[] key, int offset, int len, Holder<byte[]> valueHolder)
If the caller wants to obtain value when the key
is found in memory, then valueHolder
must be set.
This check is potentially lighter-weight than invoking
get(ColumnFamilyHandle, ReadOptions, byte[], int, int)
.
One way to make this lighter weight is to avoid doing any IOs.
columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instancekey
- byte array of a key to search foroffset
- the offset of the "key" array to be used, must be
non-negative and no larger than "key".lengthlen
- the length of the "key" array to be used, must be non-negative
and no larger than "key".lengthvalueHolder
- non-null to retrieve the value if it is found, or null
if the value is not needed. If non-null, upon return of the function,
the value
will be set if it could be retrieved.public boolean keyMayExist(java.nio.ByteBuffer key)
key
- bytebuffer containing the value of the keypublic boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, java.nio.ByteBuffer key)
columnFamilyHandle
- the ColumnFamilyHandle
to look for the key inkey
- bytebuffer containing the value of the keypublic boolean keyMayExist(ReadOptions readOptions, java.nio.ByteBuffer key)
readOptions
- the ReadOptions
to use when reading the key/valuekey
- bytebuffer containing the value of the keypublic KeyMayExist keyMayExist(java.nio.ByteBuffer key, java.nio.ByteBuffer value)
KeyMayExist.KeyMayExistEnum.kNotExist
,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue
otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue
. The choice not to return a value which might
exist is at the discretion of the implementation; the only guarantee is that KeyMayExist.KeyMayExistEnum.kNotExist
is an assurance that the key does not exist.key
- bytebuffer containing the value of the keyvalue
- bytebuffer which will receive a value if the key exists and a value is knownKeyMayExist
object reporting if key may exist and if a value is providedpublic KeyMayExist keyMayExist(ColumnFamilyHandle columnFamilyHandle, java.nio.ByteBuffer key, java.nio.ByteBuffer value)
KeyMayExist.KeyMayExistEnum.kNotExist
,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue
otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue
. The choice not to return a value which might
exist is at the discretion of the implementation; the only guarantee is that KeyMayExist.KeyMayExistEnum.kNotExist
is an assurance that the key does not exist.columnFamilyHandle
- the ColumnFamilyHandle
to look for the key inkey
- bytebuffer containing the value of the keyvalue
- bytebuffer which will receive a value if the key exists and a value is knownKeyMayExist
object reporting if key may exist and if a value is providedpublic KeyMayExist keyMayExist(ReadOptions readOptions, java.nio.ByteBuffer key, java.nio.ByteBuffer value)
KeyMayExist.KeyMayExistEnum.kNotExist
,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue
otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue
. The choice not to return a value which might
exist is at the discretion of the implementation; the only guarantee is that KeyMayExist.KeyMayExistEnum.kNotExist
is an assurance that the key does not exist.readOptions
- the ReadOptions
to use when reading the key/valuekey
- bytebuffer containing the value of the keyvalue
- bytebuffer which will receive a value if the key exists and a value is knownKeyMayExist
object reporting if key may exist and if a value is providedpublic boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, java.nio.ByteBuffer key)
columnFamilyHandle
- the ColumnFamilyHandle
to look for the key inreadOptions
- the ReadOptions
to use when reading the key/valuekey
- bytebuffer containing the value of the keypublic KeyMayExist keyMayExist(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions, java.nio.ByteBuffer key, java.nio.ByteBuffer value)
KeyMayExist.KeyMayExistEnum.kNotExist
,
otherwise if it can with best effort retreive the value, it returns KeyMayExist.KeyMayExistEnum.kExistsWithValue
otherwise it returns KeyMayExist.KeyMayExistEnum.kExistsWithoutValue
. The choice not to return a value which might
exist is at the discretion of the implementation; the only guarantee is that KeyMayExist.KeyMayExistEnum.kNotExist
is an assurance that the key does not exist.columnFamilyHandle
- the ColumnFamilyHandle
to look for the key inreadOptions
- the ReadOptions
to use when reading the key/valuekey
- bytebuffer containing the value of the keyvalue
- bytebuffer which will receive a value if the key exists and a value is knownKeyMayExist
object reporting if key may exist and if a value is providedpublic RocksIterator newIterator()
Return a heap-allocated iterator over the contents of the database. The result of newIterator() is initially invalid (caller must call one of the Seek methods on the iterator before using it).
Caller should close the iterator when it is no longer needed. The returned iterator should be closed before this db is closed.
public RocksIterator newIterator(ReadOptions readOptions)
Return a heap-allocated iterator over the contents of the database. The result of newIterator() is initially invalid (caller must call one of the Seek methods on the iterator before using it).
Caller should close the iterator when it is no longer needed. The returned iterator should be closed before this db is closed.
readOptions
- ReadOptions
instance.public RocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle)
Return a heap-allocated iterator over the contents of a ColumnFamily. The result of newIterator() is initially invalid (caller must call one of the Seek methods on the iterator before using it).
Caller should close the iterator when it is no longer needed. The returned iterator should be closed before this db is closed.
columnFamilyHandle
- ColumnFamilyHandle
instancepublic RocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle, ReadOptions readOptions)
Return a heap-allocated iterator over the contents of a ColumnFamily. The result of newIterator() is initially invalid (caller must call one of the Seek methods on the iterator before using it).
Caller should close the iterator when it is no longer needed. The returned iterator should be closed before this db is closed.
columnFamilyHandle
- ColumnFamilyHandle
instancereadOptions
- ReadOptions
instance.public java.util.List<RocksIterator> newIterators(java.util.List<ColumnFamilyHandle> columnFamilyHandleList) throws RocksDBException
columnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.List
containing RocksIterator
instancesRocksDBException
- thrown if error happens in underlying
native library.public java.util.List<RocksIterator> newIterators(java.util.List<ColumnFamilyHandle> columnFamilyHandleList, ReadOptions readOptions) throws RocksDBException
columnFamilyHandleList
- List
containing
ColumnFamilyHandle
instances.readOptions
- ReadOptions
instance.List
containing RocksIterator
instancesRocksDBException
- thrown if error happens in underlying
native library.public Snapshot getSnapshot()
Return a handle to the current DB state. Iterators created with this handle will all observe a stable snapshot of the current DB state. The caller must call ReleaseSnapshot(result) when the snapshot is no longer needed.
nullptr will be returned if the DB fails to take a snapshot or does not support snapshot.
Snapshot
instancepublic void releaseSnapshot(Snapshot snapshot)
The caller must not use "snapshot" after this call.
snapshot
- Snapshot
instancepublic java.lang.String getProperty(ColumnFamilyHandle columnFamilyHandle, java.lang.String property) throws RocksDBException
If property
is a valid property understood by this DB
implementation, fills value
with its current value and
returns true. Otherwise returns false.
Valid property names include:
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.property
- to be fetched. See above for examplesRocksDBException
- thrown if error happens in underlying
native library.public java.lang.String getProperty(java.lang.String property) throws RocksDBException
Valid property names include:
property
- to be fetched. See above for examplesRocksDBException
- thrown if error happens in underlying
native library.public java.util.Map<java.lang.String,java.lang.String> getMapProperty(java.lang.String property) throws RocksDBException
property
- to be fetched.RocksDBException
- if an error happens in the underlying native code.public java.util.Map<java.lang.String,java.lang.String> getMapProperty(ColumnFamilyHandle columnFamilyHandle, java.lang.String property) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.property
- to be fetched.RocksDBException
- if an error happens in the underlying native code.public long getLongProperty(java.lang.String property) throws RocksDBException
Similar to GetProperty(), but only works for a subset of properties whose return value is a numerical value. Return the value as long.
Note: As the returned property is of type
uint64_t
on C++ side the returning value can be negative
because Java supports in Java 7 only signed long values.
Java 7: To mitigate the problem of the non
existent unsigned long tpye, values should be encapsulated using
BigInteger
to reflect the correct value. The correct
behavior is guaranteed if 2^64
is added to negative values.
Java 8: In Java 8 the value should be treated as
unsigned long using provided methods of type Long
.
property
- to be fetched.RocksDBException
- if an error happens in the underlying native code.public long getLongProperty(ColumnFamilyHandle columnFamilyHandle, java.lang.String property) throws RocksDBException
Similar to GetProperty(), but only works for a subset of properties whose return value is a numerical value. Return the value as long.
Note: As the returned property is of type
uint64_t
on C++ side the returning value can be negative
because Java supports in Java 7 only signed long values.
Java 7: To mitigate the problem of the non
existent unsigned long tpye, values should be encapsulated using
BigInteger
to reflect the correct value. The correct
behavior is guaranteed if 2^64
is added to negative values.
Java 8: In Java 8 the value should be treated as
unsigned long using provided methods of type Long
.
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column familyproperty
- to be fetched.RocksDBException
- if an error happens in the underlying native code.public void resetStats() throws RocksDBException
Note this doesn't reset Options.statistics()
as it is not
owned by DB.
RocksDBException
- if an error occurs whilst reseting the statspublic long getAggregatedLongProperty(java.lang.String property) throws RocksDBException
Return sum of the getLongProperty of all the column families
Note: As the returned property is of type
uint64_t
on C++ side the returning value can be negative
because Java supports in Java 7 only signed long values.
Java 7: To mitigate the problem of the non
existent unsigned long tpye, values should be encapsulated using
BigInteger
to reflect the correct value. The correct
behavior is guaranteed if 2^64
is added to negative values.
Java 8: In Java 8 the value should be treated as
unsigned long using provided methods of type Long
.
property
- to be fetched.RocksDBException
- if an error happens in the underlying native code.public long[] getApproximateSizes(ColumnFamilyHandle columnFamilyHandle, java.util.List<Range> ranges, SizeApproximationFlag... sizeApproximationFlags)
Note that the returned sizes measure file system space usage, so if the user data compresses by a factor of ten, the returned sizes will be one-tenth the size of the corresponding user data size.
If sizeApproximationFlags
defines whether the returned size
should include the recently written data in the mem-tables (if
the mem-table type supports it), data serialized to disk, or both.
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column familyranges
- the ranges over which to approximate sizessizeApproximationFlags
- flags to determine what to include in the
approximation.public long[] getApproximateSizes(java.util.List<Range> ranges, SizeApproximationFlag... sizeApproximationFlags)
Note that the returned sizes measure file system space usage, so if the user data compresses by a factor of ten, the returned sizes will be one-tenth the size of the corresponding user data size.
If sizeApproximationFlags
defines whether the returned size
should include the recently written data in the mem-tables (if
the mem-table type supports it), data serialized to disk, or both.
ranges
- the ranges over which to approximate sizessizeApproximationFlags
- flags to determine what to include in the
approximation.public RocksDB.CountAndSize getApproximateMemTableStats(ColumnFamilyHandle columnFamilyHandle, Range range)
getApproximateSizes(ColumnFamilyHandle, List, SizeApproximationFlag...)
,
except that it returns approximate number of records and size in memtables.columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column familyrange
- the ranges over which to get the memtable statspublic RocksDB.CountAndSize getApproximateMemTableStats(Range range)
getApproximateSizes(ColumnFamilyHandle, List, SizeApproximationFlag...)
,
except that it returns approximate number of records and size in memtables.range
- the ranges over which to get the memtable statspublic void compactRange() throws RocksDBException
Range compaction of database.
Note: After the database has been compacted, all data will have been pushed down to the last level containing any data.
See also
RocksDBException
- thrown if an error occurs within the native
part of the library.public void compactRange(ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
Range compaction of column family.
Note: After the database has been compacted, all data will have been pushed down to the last level containing any data.
See also
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.RocksDBException
- thrown if an error occurs within the native
part of the library.public void compactRange(byte[] begin, byte[] end) throws RocksDBException
Range compaction of database.
Note: After the database has been compacted, all data will have been pushed down to the last level containing any data.
See also
begin
- start of key range (included in range)end
- end of key range (excluded from range)RocksDBException
- thrown if an error occurs within the native
part of the library.public void compactRange(ColumnFamilyHandle columnFamilyHandle, byte[] begin, byte[] end) throws RocksDBException
Range compaction of column family.
Note: After the database has been compacted, all data will have been pushed down to the last level containing any data.
See also
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.begin
- start of key range (included in range)end
- end of key range (excluded from range)RocksDBException
- thrown if an error occurs within the native
part of the library.public void compactRange(ColumnFamilyHandle columnFamilyHandle, byte[] begin, byte[] end, CompactRangeOptions compactRangeOptions) throws RocksDBException
Range compaction of column family.
Note: After the database has been compacted, all data will have been pushed down to the last level containing any data.
columnFamilyHandle
- ColumnFamilyHandle
instance.begin
- start of key range (included in range)end
- end of key range (excluded from range)compactRangeOptions
- options for the compactionRocksDBException
- thrown if an error occurs within the native
part of the library.public void clipColumnFamily(ColumnFamilyHandle columnFamilyHandle, byte[] beginKey, byte[] endKey) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instancebeginKey
- First key to clip within database (inclusive)endKey
- Last key to clip within database (exclusive)RocksDBException
- thrown if error happens in underlying
native library.public void setOptions(ColumnFamilyHandle columnFamilyHandle, MutableColumnFamilyOptions mutableColumnFamilyOptions) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.mutableColumnFamilyOptions
- the options.RocksDBException
- if an error occurs whilst setting the optionspublic void setPerfLevel(PerfLevel level)
level
- java.lang.IllegalArgumentException
- for UNINITIALIZED and OUT_OF_BOUNDS values
as they can't be used for settings.public PerfLevel getPerfLevel()
public PerfContext getPerfContext()
public MutableColumnFamilyOptions.MutableColumnFamilyOptionsBuilder getOptions(ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
columnFamilyHandle
- ColumnFamilyHandle
instance, or null for the default column family.RocksDBException
- if an error occurs while getting the options string, or parsing the
resulting options string into optionspublic MutableColumnFamilyOptions.MutableColumnFamilyOptionsBuilder getOptions() throws RocksDBException
RocksDBException
- if an error occurs while getting the options string, or parsing the
resulting options string into optionspublic MutableDBOptions.MutableDBOptionsBuilder getDBOptions() throws RocksDBException
RocksDBException
- if an error occurs while getting the options string, or parsing the
resulting options string into optionspublic void setOptions(MutableColumnFamilyOptions mutableColumnFamilyOptions) throws RocksDBException
mutableColumnFamilyOptions
- the options.RocksDBException
- if an error occurs whilst setting the optionspublic void setDBOptions(MutableDBOptions mutableDBoptions) throws RocksDBException
mutableDBoptions
- the options.RocksDBException
- if an error occurs whilst setting the optionspublic java.util.List<java.lang.String> compactFiles(CompactionOptions compactionOptions, java.util.List<java.lang.String> inputFileNames, int outputLevel, int outputPathId, CompactionJobInfo compactionJobInfo) throws RocksDBException
Note that the behavior is different from
compactRange(ColumnFamilyHandle, byte[], byte[])
in that CompactFiles() performs the compaction job using the CURRENT
thread.
compactionOptions
- compaction optionsinputFileNames
- the name of the files to compactoutputLevel
- the level to which they should be compactedoutputPathId
- the id of the output path, or -1compactionJobInfo
- the compaction job info, this parameter
will be updated with the info from compacting the files,
can just be null if you don't need it.RocksDBException
- if an error occurs during compactionpublic java.util.List<java.lang.String> compactFiles(CompactionOptions compactionOptions, ColumnFamilyHandle columnFamilyHandle, java.util.List<java.lang.String> inputFileNames, int outputLevel, int outputPathId, CompactionJobInfo compactionJobInfo) throws RocksDBException
Note that the behavior is different from
compactRange(ColumnFamilyHandle, byte[], byte[])
in that CompactFiles() performs the compaction job using the CURRENT
thread.
compactionOptions
- compaction optionscolumnFamilyHandle
- columnFamilyHandle, or null for the
default column familyinputFileNames
- the name of the files to compactoutputLevel
- the level to which they should be compactedoutputPathId
- the id of the output path, or -1compactionJobInfo
- the compaction job info, this parameter
will be updated with the info from compacting the files,
can just be null if you don't need it.RocksDBException
- if an error occurs during compactionpublic void cancelAllBackgroundWork(boolean wait)
wait
- if true, wait for all background work to be cancelled before
returning.public void pauseBackgroundWork() throws RocksDBException
continueBackgroundWork()
is calledRocksDBException
- if an error occurs when pausing background workpublic void continueBackgroundWork() throws RocksDBException
pauseBackgroundWork()
RocksDBException
- if an error occurs when resuming background workpublic void enableAutoCompaction(java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
The function will first set the
ColumnFamilyOptions.disableAutoCompactions()
option for each
column family to false, after which it will schedule a flush/compaction.
NOTE: Setting disableAutoCompactions to 'false' through
setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
does NOT schedule a flush/compaction afterwards, and only changes the
parameter itself within the column family option.
columnFamilyHandles
- the column family handlesRocksDBException
- if an error occurs whilst enabling auto-compactionpublic int numberLevels()
public int numberLevels(ColumnFamilyHandle columnFamilyHandle)
columnFamilyHandle
- the column family handle, or null
for the default column familypublic int maxMemCompactionLevel()
public int maxMemCompactionLevel(ColumnFamilyHandle columnFamilyHandle)
columnFamilyHandle
- the column family handlepublic int level0StopWriteTrigger()
public int level0StopWriteTrigger(ColumnFamilyHandle columnFamilyHandle)
columnFamilyHandle
- the column family handlepublic java.lang.String getName()
open(Options, String)
.public Env getEnv()
public void flush(FlushOptions flushOptions) throws RocksDBException
Flush all memory table data.
Note: it must be ensured that the FlushOptions instance is not GC'ed before this method finishes. If the wait parameter is set to false, flush processing is asynchronous.
flushOptions
- FlushOptions
instance.RocksDBException
- thrown if an error occurs within the native
part of the library.public void flush(FlushOptions flushOptions, ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
Flush all memory table data.
Note: it must be ensured that the FlushOptions instance is not GC'ed before this method finishes. If the wait parameter is set to false, flush processing is asynchronous.
flushOptions
- FlushOptions
instance.columnFamilyHandle
- ColumnFamilyHandle
instance.RocksDBException
- thrown if an error occurs within the native
part of the library.public void flush(FlushOptions flushOptions, java.util.List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException
If atomic flush is not enabled, this is equivalent to calling
flush(FlushOptions, ColumnFamilyHandle)
multiple times.
If atomic flush is enabled, this will flush all column families specified up to the latest sequence number at the time when flush is requested.
flushOptions
- FlushOptions
instance.columnFamilyHandles
- column family handles.RocksDBException
- thrown if an error occurs within the native
part of the library.public void flushWal(boolean sync) throws RocksDBException
sync
is true,
it calls syncWal()
afterwards.sync
- true to also fsync to disk.RocksDBException
- if an error occurs whilst flushingpublic void syncWal() throws RocksDBException
Note that write(WriteOptions, WriteBatch)
followed by
#syncWal()
is not exactly the same as
write(WriteOptions, WriteBatch)
with
WriteOptions.sync()
set to true; In the latter case the changes
won't be visible until the sync is done.
Currently only works if Options.allowMmapWrites()
is set to false.
RocksDBException
- if an error occurs whilst syncingpublic long getLatestSequenceNumber()
The sequence number of the most recent transaction.
public void disableFileDeletions() throws RocksDBException
Prevent file deletions. Compactions will continue to occur, but no obsolete files will be deleted. Calling this multiple times have the same effect as calling it once.
RocksDBException
- thrown if operation was not performed
successfully.public void enableFileDeletions() throws RocksDBException
EnableFileDeletions will only enable file deletion after it's been called at least as many times as DisableFileDeletions(), enabling the two methods to be called by two threads concurrently without synchronization -- i.e., file deletions will be enabled only after both threads call EnableFileDeletions()
RocksDBException
- thrown if operation was not performed
successfully.public RocksDB.LiveFiles getLiveFiles() throws RocksDBException
RocksDBException
- if an error occurs whilst retrieving the list
of live filespublic RocksDB.LiveFiles getLiveFiles(boolean flushMemtable) throws RocksDBException
In case you have multiple column families, even if flushMemtable
is true, you still need to call getSortedWalFiles()
after #getLiveFiles(boolean)
to compensate for new data that
arrived to already-flushed column families while other column families
were flushing.
NOTE: Calling #getLiveFiles(boolean)
followed by
getSortedWalFiles()
can generate a lossless backup.
flushMemtable
- set to true to flush before recoding the live
files. Setting to false is useful when we don't want to wait for flush
which may have to wait for compaction to complete taking an
indeterminate time.RocksDBException
- if an error occurs whilst retrieving the list
of live filespublic java.util.List<LogFile> getSortedWalFiles() throws RocksDBException
RocksDBException
- if an error occurs whilst retrieving the list
of sorted WAL filespublic TransactionLogIterator getUpdatesSince(long sequenceNumber) throws RocksDBException
Returns an iterator that is positioned at a write-batch containing seq_number. If the sequence number is non existent, it returns an iterator at the first available seq_no after the requested seq_no.
Must set WAL_ttl_seconds or WAL_size_limit_MB to large values to use this api, else the WAL files will get cleared aggressively and the iterator might keep getting invalid before an update is read.
sequenceNumber
- sequence number offsetTransactionLogIterator
instance.RocksDBException
- if iterator cannot be retrieved
from native-side.public void deleteFile(java.lang.String name) throws RocksDBException
name
- the file nameRocksDBException
- if an error occurs whilst deleting the filepublic java.util.List<LiveFileMetaData> getLiveFilesMetaData()
public ColumnFamilyMetaData getColumnFamilyMetaData(ColumnFamilyHandle columnFamilyHandle)
columnFamilyHandle
- the column familypublic ColumnFamilyMetaData getColumnFamilyMetaData()
public void ingestExternalFile(java.util.List<java.lang.String> filePathList, IngestExternalFileOptions ingestExternalFileOptions) throws RocksDBException
(1) External SST files can be created using SstFileWriter
(2) We will try to ingest the files to the lowest possible level
even if the file compression doesn't match the level compression
filePathList
- The list of files to ingestingestExternalFileOptions
- the options for the ingestionRocksDBException
- thrown if error happens in underlying
native library.public void ingestExternalFile(ColumnFamilyHandle columnFamilyHandle, java.util.List<java.lang.String> filePathList, IngestExternalFileOptions ingestExternalFileOptions) throws RocksDBException
(1) External SST files can be created using SstFileWriter
(2) We will try to ingest the files to the lowest possible level
even if the file compression doesn't match the level compression
columnFamilyHandle
- The column family for the ingested filesfilePathList
- The list of files to ingestingestExternalFileOptions
- the options for the ingestionRocksDBException
- thrown if error happens in underlying
native library.public void verifyChecksum() throws RocksDBException
RocksDBException
- if the checksum is not validpublic ColumnFamilyHandle getDefaultColumnFamily()
protected ColumnFamilyHandle makeDefaultColumnFamilyHandle()
public java.util.Map<java.lang.String,TableProperties> getPropertiesOfAllTables(ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
columnFamilyHandle
- the column family handle, or null for the default
column family.RocksDBException
- if an error occurs whilst getting the propertiespublic java.util.Map<java.lang.String,TableProperties> getPropertiesOfAllTables() throws RocksDBException
RocksDBException
- if an error occurs whilst getting the propertiespublic java.util.Map<java.lang.String,TableProperties> getPropertiesOfTablesInRange(ColumnFamilyHandle columnFamilyHandle, java.util.List<Range> ranges) throws RocksDBException
columnFamilyHandle
- the column family handle, or null for the default
column family.ranges
- the ranges over which to get the table propertiesRocksDBException
- if an error occurs whilst getting the propertiespublic java.util.Map<java.lang.String,TableProperties> getPropertiesOfTablesInRange(java.util.List<Range> ranges) throws RocksDBException
ranges
- the ranges over which to get the table propertiesRocksDBException
- if an error occurs whilst getting the propertiespublic Range suggestCompactRange(ColumnFamilyHandle columnFamilyHandle) throws RocksDBException
columnFamilyHandle
- the column family handle, or null for the default
column family.RocksDBException
- if an error occurs whilst suggesting the rangepublic Range suggestCompactRange() throws RocksDBException
RocksDBException
- if an error occurs whilst suggesting the rangepublic void promoteL0(ColumnFamilyHandle columnFamilyHandle, int targetLevel) throws RocksDBException
columnFamilyHandle
- the column family handle,
or null for the default column family.targetLevel
- the target level for L0RocksDBException
- if an error occurs whilst promoting L0public void promoteL0(int targetLevel) throws RocksDBException
targetLevel
- the target level for L0RocksDBException
- if an error occurs whilst promoting L0public void startTrace(TraceOptions traceOptions, AbstractTraceWriter traceWriter) throws RocksDBException
Use endTrace()
to stop tracing.
traceOptions
- the optionstraceWriter
- the trace writerRocksDBException
- if an error occurs whilst starting the tracepublic void endTrace() throws RocksDBException
RocksDBException
- if an error occurs whilst ending the tracepublic void tryCatchUpWithPrimary() throws RocksDBException
RocksDBException
- thrown if error happens in underlying
native library.public void deleteFilesInRanges(ColumnFamilyHandle columnFamily, java.util.List<byte[]> ranges, boolean includeEnd) throws RocksDBException
columnFamily
- - The column family for operation (null for default)includeEnd
- - Whether ranges should include endranges
- - pairs of ranges (from1, to1, from2, to2, ...)RocksDBException
- thrown if error happens in underlying
native library.public static void destroyDB(java.lang.String path, Options options) throws RocksDBException
path
- the path to the Rocksdb database.options
- Options
instance.RocksDBException
- thrown if error happens in underlying
native library.protected void storeOptionsInstance(DBOptionsInterface<?> options)
protected void storeDefaultColumnFamilyHandle(ColumnFamilyHandle columnFamilyHandle)
protected void disposeInternal(long handle)
disposeInternal
in class RocksObject