public class WriteBatch extends RocksObject
Modifier and Type | Class and Description |
---|---|
static class |
WriteBatch.Handler
Handler callback for iterating over the contents of a batch.
|
nativeHandle_
Constructor and Description |
---|
WriteBatch()
Constructs a WriteBatch instance.
|
WriteBatch(int reserved_bytes)
Constructs a WriteBatch instance with a given size.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all updates buffered in this batch
|
int |
count()
Returns the number of updates in the batch.
|
protected void |
disposeInternal()
Delete the c++ side pointer.
|
void |
iterate(WriteBatch.Handler handler)
Support for iterating over the contents of a batch.
|
void |
merge(byte[] key,
byte[] value)
Merge "value" with the existing value of "key" in the database.
|
void |
merge(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
byte[] value)
Merge "value" with the existing value of "key" in given column family.
|
void |
put(byte[] key,
byte[] value)
Store the mapping "key->value" in the database.
|
void |
put(ColumnFamilyHandle columnFamilyHandle,
byte[] key,
byte[] value)
Store the mapping "key->value" within given column
family.
|
void |
putLogData(byte[] blob)
Append a blob of arbitrary size to the records in this batch.
|
void |
remove(byte[] key)
If the database contains a mapping for "key", erase it.
|
void |
remove(ColumnFamilyHandle columnFamilyHandle,
byte[] key)
If column family contains a mapping for "key", erase it.
|
disOwnNativeHandle, dispose, finalize, isInitialized, isOwningNativeHandle
public WriteBatch()
public WriteBatch(int reserved_bytes)
reserved_bytes
- reserved size for WriteBatchpublic int count()
public void put(byte[] key, byte[] value)
Store the mapping "key->value" in the database.
key
- the specified key to be inserted.value
- the value associated with the specified key.public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value)
Store the mapping "key->value" within given column family.
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the specified key to be inserted.value
- the value associated with the specified key.public void merge(byte[] key, byte[] value)
Merge "value" with the existing value of "key" in the database. "key->merge(existing, value)"
key
- the specified key to be merged.value
- the value to be merged with the current value for
the specified key.public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value)
Merge "value" with the existing value of "key" in given column family. "key->merge(existing, value)"
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- the specified key to be merged.value
- the value to be merged with the current value for
the specified key.public void remove(byte[] key)
If the database contains a mapping for "key", erase it. Else do nothing.
key
- Key to delete within databasepublic void remove(ColumnFamilyHandle columnFamilyHandle, byte[] key)
If column family contains a mapping for "key", erase it. Else do nothing.
columnFamilyHandle
- ColumnFamilyHandle
instancekey
- Key to delete within databasepublic void putLogData(byte[] blob)
blob
- binary object to be insertedpublic void iterate(WriteBatch.Handler handler) throws RocksDBException
handler
- A handler that is called back for each
update present in the batchRocksDBException
- If we cannot iterate over the batchpublic void clear()
protected void disposeInternal()
disposeInternal
in class RocksObject