public class WriteBatchWithIndex extends AbstractWriteBatch
WriteBatch
but with a binary searchable
index built for all the keys inserted.
Calling put, merge, remove or putLogData calls the same function
as with WriteBatch
whilst also building an index.
A user can call newIterator()
to
create an iterator over the write batch or
newIteratorWithBase(org.rocksdb.RocksIterator)
to get an iterator for the database with Read-Your-Own-Writes like capabilitynativeHandle_
Constructor and Description |
---|
WriteBatchWithIndex()
Creates a WriteBatchWithIndex where no bytes
are reserved up-front, bytewise comparison is
used for fallback key comparisons,
and duplicate keys operations are retained
|
WriteBatchWithIndex(AbstractComparator<? extends AbstractSlice<?>> fallbackIndexComparator,
int reservedBytes,
boolean overwriteKey)
Creates a WriteBatchWithIndex
|
WriteBatchWithIndex(boolean overwriteKey)
Creates a WriteBatchWithIndex where no bytes
are reserved up-front, bytewise comparison is
used for fallback key comparisons, and duplicate key
assignment is determined by the constructor argument
|
Modifier and Type | Method and Description |
---|---|
protected void |
disposeInternal(long handle) |
WBWIRocksIterator |
newIterator()
Create an iterator of the default column family.
|
WBWIRocksIterator |
newIterator(ColumnFamilyHandle columnFamilyHandle)
Create an iterator of a column family.
|
RocksIterator |
newIteratorWithBase(ColumnFamilyHandle columnFamilyHandle,
RocksIterator baseIterator)
Provides Read-Your-Own-Writes like functionality by
creating a new Iterator that will use
WBWIRocksIterator
as a delta and baseIterator as a base |
RocksIterator |
newIteratorWithBase(RocksIterator baseIterator)
Provides Read-Your-Own-Writes like functionality by
creating a new Iterator that will use
WBWIRocksIterator
as a delta and baseIterator as a base. |
clear, count, merge, merge, put, put, putLogData, remove, remove
disposeInternal
close, disOwnNativeHandle, isOwningHandle
dispose, finalize
public WriteBatchWithIndex()
public WriteBatchWithIndex(boolean overwriteKey)
overwriteKey
- if true, overwrite the key in the index when
inserting a duplicate key, in this way an iterator will never
show two entries with the same key.public WriteBatchWithIndex(AbstractComparator<? extends AbstractSlice<?>> fallbackIndexComparator, int reservedBytes, boolean overwriteKey)
fallbackIndexComparator
- We fallback to this comparator
to compare keys within a column family if we cannot determine
the column family and so look up it's comparator.reservedBytes
- reserved bytes in underlying WriteBatchoverwriteKey
- if true, overwrite the key in the index when
inserting a duplicate key, in this way an iterator will never
show two entries with the same key.public WBWIRocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle)
RocksIteratorInterface.seek(byte[])
to
search to the next entry of or after a key. Keys will be iterated in the
order given by index_comparator. For multiple updates on the same key,
each update will be returned as a separate entry, in the order of update
time.columnFamilyHandle
- The column family to iterate overpublic WBWIRocksIterator newIterator()
RocksIteratorInterface.seek(byte[])
to
search to the next entry of or after a key. Keys will be iterated in the
order given by index_comparator. For multiple updates on the same key,
each update will be returned as a separate entry, in the order of update
time.public RocksIterator newIteratorWithBase(ColumnFamilyHandle columnFamilyHandle, RocksIterator baseIterator)
WBWIRocksIterator
as a delta and baseIterator as a basecolumnFamilyHandle
- The column family to iterate overbaseIterator
- The base iterator,
e.g. RocksDB.newIterator()
public RocksIterator newIteratorWithBase(RocksIterator baseIterator)
WBWIRocksIterator
as a delta and baseIterator as a base. Operates on the default column
family.baseIterator
- The base iterator,
e.g. RocksDB.newIterator()
protected final void disposeInternal(long handle)
disposeInternal
in class RocksObject