Class KvStore<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    KvTable<T>

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean exists​(T keyValue)
      Cognate of KvTable.lookup(Object, boolean), this function checks for the presence of an entry with a specific key.
      com.mapr.fs.proto.Common.FidMsg getFid()  
      int getKeyCnt()  
      T getKeyFromKvStoreKey​(com.mapr.fs.proto.Fileserver.KvStoreKey key)  
      long getKvVersion()  
      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.
      com.mapr.fs.proto.Fileserver.KvStoreKey getMaxKey()  
      com.mapr.fs.proto.Fileserver.KvStoreKey getMinKey()  
      long getNBlocks()  
      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.
      Scanner getScanner​(boolean keysOnly)  
      Scanner getScanner​(com.mapr.fs.proto.Fileserver.KvStoreKey startKey, com.mapr.fs.proto.Fileserver.KvStoreKey endKey, boolean keysOnly)  
      Scanner getScanner​(T startKey, boolean keysOnly)  
      Scanner getScanner​(T startKey, T endKey, boolean keysOnly)  
      java.lang.String getTableName()  
      static com.mapr.fs.proto.Common.FSKeyType gettype​(KvStoreClient clnt, java.lang.String name)  
      byte[] lookup​(T keyValue)  
      byte[] lookup​(T keyValue, boolean allowStaleRead)  
      com.mapr.fs.proto.Fileserver.KvstoreLookupNearResponse lookupNear​(T key)
      Fetch values of keys that are adjacent to a specific key.
      int open​(java.lang.String name)
      Initializes in-memory state of the table, such as setting key type (where necessary).
      com.mapr.fs.proto.Fileserver.KvStoreKey parseKvStoreKey​(java.lang.String keyString)  
      void printKey​(com.mapr.fs.proto.Fileserver.KvStoreKey key)  
      static java.lang.String setThreadName​(com.mapr.fs.proto.Fileserver.FSProg prog, com.mapr.fs.proto.Common.FidMsg fid)  
      void setType​(int type)  
      void setVarKeyType​(java.lang.String type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KvStore

        @Deprecated
        public KvStore​(KvStoreClient clnt)
        Deprecated.
      • KvStore

        public KvStore​(KvStoreClient clnt,
                       com.mapr.fs.proto.Security.CredentialsMsg creds)
    • Method Detail

      • getFid

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

        public int open​(java.lang.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​(java.lang.String type)
        Specified by:
        setVarKeyType in interface KvTable<T>
      • getTableName

        public java.lang.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 java.lang.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()
      • 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​(java.lang.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>
      • printKey

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

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

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