Class KvStore<T>

java.lang.Object
com.mapr.kvstore.KvStore<T>
Type Parameters:
T -
All Implemented Interfaces:
KvTable<T>

public class KvStore<T> extends Object implements KvTable<T>
MapR Filesystem based implementation of Key-Value table interface.
See Also:
  • Constructor Details

  • Method Details

    • getFid

      public com.mapr.fs.proto.Common.FidMsg getFid()
    • open

      public int open(String name)
      Description copied from interface: KvTable
      Initializes in-memory state of the table, such as setting key type (where necessary).
      Specified by:
      open in interface KvTable<T>
      Parameters:
      name - name of the key-value table to be initialized
      Returns:
    • setVarKeyType

      public void setVarKeyType(String type)
      Specified by:
      setVarKeyType in interface KvTable<T>
    • getTableName

      public String getTableName()
      Specified by:
      getTableName in interface KvTable<T>
    • close

      public void close()
      Specified by:
      close in interface KvTable<T>
    • lookup

      public byte[] lookup(T keyValue)
      Specified by:
      lookup in interface KvTable<T>
    • lookup

      public byte[] lookup(T keyValue, boolean allowStaleRead)
      Specified by:
      lookup in interface KvTable<T>
    • setThreadName

      public static String setThreadName(com.mapr.fs.proto.Fileserver.FSProg prog, com.mapr.fs.proto.Common.FidMsg fid)
    • getLeftNearValue

      public com.mapr.fs.proto.Fileserver.KvMsg getLeftNearValue(T key)
      Get the value corresponding to the key that is either less or equal to the key specified as the argument.
      Specified by:
      getLeftNearValue in interface KvTable<T>
      Parameters:
      key - value of the key being looked up.
      Returns:
      the left near value, if present null, if there are no keys that are equal to or lower than the first argument
    • getRightNearValue

      public com.mapr.fs.proto.Fileserver.KvMsg getRightNearValue(T key)
      Get the value corresponding to the key that is greater than the key specified as the argument.
      Specified by:
      getRightNearValue in interface KvTable<T>
      Parameters:
      key - value of the key being looked up.
      Returns:
      the right near value, if present null, if there are no keys that are greater than the argument
    • lookupNear

      public com.mapr.fs.proto.Fileserver.KvstoreLookupNearResponse lookupNear(T key) throws KvStoreException
      Fetch values of keys that are adjacent to a specific key.
      Specified by:
      lookupNear in interface KvTable<T>
      Parameters:
      key -
      Returns:
      Throws:
      KvStoreException
    • getMinKey

      public com.mapr.fs.proto.Fileserver.KvStoreKey getMinKey()
      Specified by:
      getMinKey in interface KvTable<T>
    • getMaxKey

      public com.mapr.fs.proto.Fileserver.KvStoreKey getMaxKey()
      Specified by:
      getMaxKey in interface KvTable<T>
    • getKeyCnt

      public int getKeyCnt()
      Specified by:
      getKeyCnt in interface KvTable<T>
    • getNBlocks

      public long getNBlocks()
    • getKvVersion

      public long getKvVersion()
      Specified by:
      getKvVersion in interface KvTable<T>
    • exists

      public boolean exists(T keyValue)
      Description copied from interface: KvTable
      Cognate of KvTable.lookup(Object, boolean), this function checks for the presence of an entry with a specific key.
      Specified by:
      exists in interface KvTable<T>
      Returns:
    • getKeyFromKvStoreKey

      public T getKeyFromKvStoreKey(com.mapr.fs.proto.Fileserver.KvStoreKey key)
      Specified by:
      getKeyFromKvStoreKey in interface KvTable<T>
    • parseKvStoreKey

      public com.mapr.fs.proto.Fileserver.KvStoreKey parseKvStoreKey(String keyString)
    • getScanner

      public Scanner getScanner(com.mapr.fs.proto.Fileserver.KvStoreKey startKey, com.mapr.fs.proto.Fileserver.KvStoreKey endKey, boolean keysOnly)
    • getScanner

      public Scanner getScanner(T startKey, T endKey, boolean keysOnly)
      Specified by:
      getScanner in interface KvTable<T>
    • getScanner

      public Scanner getScanner(T startKey, boolean keysOnly)
      Specified by:
      getScanner in interface KvTable<T>
    • getScanner

      public Scanner getScanner(boolean keysOnly)
      Specified by:
      getScanner in interface KvTable<T>
    • printKey

      public void printKey(com.mapr.fs.proto.Fileserver.KvStoreKey key)
    • gettype

      public static com.mapr.fs.proto.Common.FSKeyType gettype(KvStoreClient clnt, String name)
    • setType

      public void setType(int type)
      Specified by:
      setType in interface KvTable<T>