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

public class ByteArrayLMDBKVStore extends LMDBKVStore<byte[]>
KVStore view of a LMDB transaction using byte[] array buffers.

Instances must be LMDBKVStore.close()'d when no longer needed to avoid leaking resources.

  • 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 database
      tx - LMDB transaction
      Throws:
      IllegalArgumentException - if db or tx is null
  • Method Details

    • wrap

      protected byte[] wrap(byte[] data, boolean copy)
      Description copied from class: LMDBKVStore
      Wrap the given byte array in a buffer appropriate for this instance.
      Specified by:
      wrap in class LMDBKVStore<byte[]>
      Parameters:
      data - byte array data, or possibly null
      copy - if true, then changes to the data in either buf or the returned buffer must not affect the other
      Returns:
      null if buf is null, otherwise a buffer containing the data in buf
    • unwrap

      protected byte[] unwrap(byte[] data, boolean copy)
      Description copied from class: LMDBKVStore
      Unwrap the given buffer, returning its contents as a byte array.
      Specified by:
      unwrap in class LMDBKVStore<byte[]>
      Parameters:
      data - a buffer containing byte[] array data, or possibly null
      copy - if true, then changes to the data in either buf or the returned array must not affect the other
      Returns:
      byte array data in buf, or null if buf is null