Package io.permazen.kv.lmdb
Class ByteArrayLMDBKVStore
java.lang.Object
io.permazen.kv.AbstractKVStore
io.permazen.kv.lmdb.LMDBKVStore<byte[]>
io.permazen.kv.lmdb.ByteArrayLMDBKVStore
- All Implemented Interfaces:
CloseableKVStore
,KVStore
,Closeable
,AutoCloseable
KVStore
view of a LMDB transaction using byte[]
array buffers.
Instances must be LMDBKVStore.close()
'd when no longer needed to avoid leaking resources.
-
Field Summary
Fields inherited from class io.permazen.kv.lmdb.LMDBKVStore
log
-
Constructor Summary
ConstructorDescriptionByteArrayLMDBKVStore
(org.lmdbjava.Dbi<byte[]> db, org.lmdbjava.Txn<byte[]> tx) Constructor. -
Method Summary
Methods inherited from class io.permazen.kv.lmdb.LMDBKVStore
close, finalize, get, getDatabase, getKeyRange, getRange, getTransaction, isClosed, put, remove, removeRange, toString
Methods inherited from class io.permazen.kv.AbstractKVStore
adjustCounter, decodeCounter, encodeCounter, getAtLeast, getAtMost
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.permazen.kv.KVStore
adjustCounter, apply, decodeCounter, encodeCounter, getAtLeast, getAtMost, getRange, getRange, removeRange
-
Constructor Details
-
ByteArrayLMDBKVStore
public ByteArrayLMDBKVStore(org.lmdbjava.Dbi<byte[]> db, org.lmdbjava.Txn<byte[]> tx) Constructor.Closing this instance does not close the underlying transaction.
- Parameters:
db
- LMDB databasetx
- LMDB transaction- Throws:
IllegalArgumentException
- ifdb
ortx
is null
-
-
Method Details
-
wrap
protected byte[] wrap(byte[] data, boolean copy) Description copied from class:LMDBKVStore
Wrap the givenbyte[]
array in a buffer appropriate for this instance.- Specified by:
wrap
in classLMDBKVStore<byte[]>
- Parameters:
data
- byte array data, or possibly nullcopy
- if true, then changes to the data in eitherbuf
or the returned buffer must not affect the other- Returns:
- null if
buf
is null, otherwise a buffer containing the data inbuf
-
unwrap
protected byte[] unwrap(byte[] data, boolean copy) Description copied from class:LMDBKVStore
Unwrap the given buffer, returning its contents as abyte[]
array.- Specified by:
unwrap
in classLMDBKVStore<byte[]>
- Parameters:
data
- a buffer containingbyte[]
array data, or possibly nullcopy
- if true, then changes to the data in eitherbuf
or the returned array must not affect the other- Returns:
- byte array data in
buf
, or null ifbuf
is null
-