Class RandomHBaseReader

  • All Implemented Interfaces:
    RandomAccessReader, java.io.Closeable, java.lang.AutoCloseable

    public class RandomHBaseReader
    extends java.lang.Object
    implements RandomAccessReader
    RandomAccessReader for HBase.
    • Constructor Detail

      • RandomHBaseReader

        public RandomHBaseReader​(java.net.URI uri,
                                 org.apache.hadoop.conf.Configuration conf,
                                 java.util.Map<java.lang.String,​java.lang.Object> cfg,
                                 EntityDescriptor entity)
    • Method Detail

      • fetchOffset

        public RandomOffset fetchOffset​(RandomAccessReader.Listing type,
                                        java.lang.String key)
        Description copied from interface: RandomAccessReader
        Construct Offset from string (representing either key of the entity or attribute). The returned offset represents the first element that is following the given key, in case of equality.
        Specified by:
        fetchOffset in interface RandomAccessReader
        Parameters:
        type - the type of the key
        key - the key of entity or attribute
        Returns:
        offset representation of the key
      • get

        public <T> java.util.Optional<KeyValue<T>> get​(java.lang.String key,
                                                       java.lang.String attribute,
                                                       AttributeDescriptor<T> desc,
                                                       long stamp)
        Description copied from interface: RandomAccessReader
        Retrieve data stored under given (key, attribute) pair (if any).
        Specified by:
        get in interface RandomAccessReader
        Type Parameters:
        T - value type
        Parameters:
        key - key of the entity
        attribute - name of the attribute
        desc - the attribute to search for
        stamp - timestamp to relatively to which retrieve the data
        Returns:
        optional KeyValue if present
      • scanWildcard

        public <T> void scanWildcard​(java.lang.String key,
                                     AttributeDescriptor<T> wildcard,
                                     RandomOffset offset,
                                     long stamp,
                                     int limit,
                                     Consumer<KeyValue<T>> consumer)
        Description copied from interface: RandomAccessReader
        List data stored for a particular wildcard attribute.
        Specified by:
        scanWildcard in interface RandomAccessReader
        Type Parameters:
        T - value type
        Parameters:
        key - key of the entity
        wildcard - wildcard attribute to scan
        offset - name of attribute (including the prefix) to start from
        stamp - timestamp to relatively to which retrieve the data
        limit - maximal number of items to consume *
        consumer - the consumer to stream data to
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • scanWildcardAll

        public void scanWildcardAll​(java.lang.String key,
                                    RandomOffset offset,
                                    long stamp,
                                    int limit,
                                    Consumer<KeyValue<?>> consumer)
        Description copied from interface: RandomAccessReader
        Scan all data stored per given key.
        Specified by:
        scanWildcardAll in interface RandomAccessReader
        Parameters:
        key - the key whose KeyValues to scan
        offset - offset to start from (next key value will be returned)
        stamp - timestamp to relatively to which retrieve the data
        limit - how many elements to process at most
        consumer - consumer to use for scanning
      • getUri

        public java.net.URI getUri()