@Stable public interface RandomAccessReader extends java.io.Closeable
AbstractAttributeWriter and RandomAccessReader can be used to access data stored at that
attribute family by random access. The data can be either get by pair (key, attribute) or scanned
through by a mask (key, attributePrefix) for attributes that are wildcard attributes.| Modifier and Type | Interface and Description |
|---|---|
static interface |
RandomAccessReader.Factory<T extends RandomAccessReader>
Serializable factory for RandomAccessReader. |
static class |
RandomAccessReader.Listing
Type of listing (either listing entities of entity attributes).
|
| Modifier and Type | Method and Description |
|---|---|
RandomAccessReader.Factory<?> |
asFactory()
Convert instance of this reader to
RandomAccessReader.Factory suitable for serialization. |
RandomOffset |
fetchOffset(RandomAccessReader.Listing type,
java.lang.String key)
Construct
Offset from string (representing either key of the entity or attribute). |
default <T> java.util.Optional<KeyValue<T>> |
get(java.lang.String key,
AttributeDescriptor<T> desc)
Retrieve data stored under given (key, attribute) pair (if any).
|
default <T> java.util.Optional<KeyValue<T>> |
get(java.lang.String key,
AttributeDescriptor<T> desc,
long stamp)
Retrieve data stored under given (key, attribute) pair (if any).
|
default <T> java.util.Optional<KeyValue<T>> |
get(java.lang.String key,
java.lang.String attribute,
AttributeDescriptor<T> desc)
Retrieve data stored under given (key, attribute) pair (if any).
|
<T> java.util.Optional<KeyValue<T>> |
get(java.lang.String key,
java.lang.String attribute,
AttributeDescriptor<T> desc,
long stamp)
Retrieve data stored under given (key, attribute) pair (if any).
|
EntityDescriptor |
getEntityDescriptor()
Retrieve entity associated with this reader.
|
default void |
listEntities(Consumer<Pair<RandomOffset,java.lang.String>> consumer)
List all entity keys.
|
void |
listEntities(RandomOffset offset,
int limit,
Consumer<Pair<RandomOffset,java.lang.String>> consumer)
List all entity keys with offset and limit.
|
static MultiAccessBuilder |
newBuilder(Repository repo,
ContextProvider context)
Create a new builder that is able to construct
RandomAccessReader from multiple readers
responsible for reading from various attribute families. |
default <T> void |
scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
Consumer<KeyValue<T>> consumer)
List data stored for a particular wildcard attribute.
|
default <T> void |
scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
long stamp,
Consumer<KeyValue<T>> consumer)
List data stored for a particular wildcard attribute.
|
default <T> void |
scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
RandomOffset offset,
int limit,
Consumer<KeyValue<T>> consumer)
List data stored for a particular wildcard attribute.
|
<T> void |
scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
RandomOffset offset,
long stamp,
int limit,
Consumer<KeyValue<T>> consumer)
List data stored for a particular wildcard attribute.
|
default void |
scanWildcardAll(java.lang.String key,
Consumer<KeyValue<?>> consumer)
Scan all data stored per given key.
|
default void |
scanWildcardAll(java.lang.String key,
long stamp,
Consumer<KeyValue<?>> consumer)
Scan all data stored per given key.
|
default void |
scanWildcardAll(java.lang.String key,
RandomOffset offset,
int limit,
Consumer<KeyValue<?>> consumer)
Scan all data stored per given key.
|
void |
scanWildcardAll(java.lang.String key,
RandomOffset offset,
long stamp,
int limit,
Consumer<KeyValue<?>> consumer)
Scan all data stored per given key.
|
static MultiAccessBuilder newBuilder(Repository repo, ContextProvider context)
RandomAccessReader from multiple readers
responsible for reading from various attribute families.repo - the Repositorycontext - direct translation context provider (e.g. DirectDataOperator)RandomOffset fetchOffset(RandomAccessReader.Listing type, java.lang.String key)
Offset from string (representing either key of the entity or attribute).type - the type of the keykey - the key of entity or attributedefault <T> java.util.Optional<KeyValue<T>> get(java.lang.String key, AttributeDescriptor<T> desc)
T - value typekey - key of the entitydesc - the attribute to search for (not wildcard)KeyValue if presentdefault <T> java.util.Optional<KeyValue<T>> get(java.lang.String key, AttributeDescriptor<T> desc, long stamp)
T - value typekey - key of the entitydesc - the attribute to search for (not wildcard)stamp - timestamp to relatively to which retrieve the dataKeyValue if presentdefault <T> java.util.Optional<KeyValue<T>> get(java.lang.String key, java.lang.String attribute, AttributeDescriptor<T> desc)
T - value typekey - key of the entityattribute - name of the attributedesc - the attribute to search forKeyValue if present<T> java.util.Optional<KeyValue<T>> get(java.lang.String key, java.lang.String attribute, AttributeDescriptor<T> desc, long stamp)
T - value typekey - key of the entityattribute - name of the attributedesc - the attribute to search forstamp - timestamp to relatively to which retrieve the dataKeyValue if presentdefault void scanWildcardAll(java.lang.String key,
Consumer<KeyValue<?>> consumer)
key - the key whose KeyValues to scanconsumer - consumer to use for scanningdefault void scanWildcardAll(java.lang.String key,
long stamp,
Consumer<KeyValue<?>> consumer)
key - the key whose KeyValues to scanstamp - timestamp to relatively to which retrieve the dataconsumer - consumer to use for scanningdefault void scanWildcardAll(java.lang.String key,
@Nullable
RandomOffset offset,
int limit,
Consumer<KeyValue<?>> consumer)
key - the key whose KeyValues to scanoffset - offset to start from (next key value will be returned)limit - how many elements to process at mostconsumer - consumer to use for scanningvoid scanWildcardAll(java.lang.String key,
@Nullable
RandomOffset offset,
long stamp,
int limit,
Consumer<KeyValue<?>> consumer)
key - the key whose KeyValues to scanoffset - offset to start from (next key value will be returned)stamp - timestamp to relatively to which retrieve the datalimit - how many elements to process at mostconsumer - consumer to use for scanningdefault <T> void scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
Consumer<KeyValue<T>> consumer)
T - value typekey - key of the entitywildcard - wildcard attribute to scanconsumer - the consumer to stream data todefault <T> void scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
long stamp,
Consumer<KeyValue<T>> consumer)
T - value typekey - key of the entitywildcard - wildcard attribute to scanstamp - timestamp to relatively to which retrieve the dataconsumer - the consumer to stream data todefault <T> void scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
@Nullable
RandomOffset offset,
int limit,
Consumer<KeyValue<T>> consumer)
T - value typekey - key of the entitywildcard - wildcard attribute to scanoffset - name of attribute (including the prefix) to start fromlimit - maximal number of items to consume *consumer - the consumer to stream data to<T> void scanWildcard(java.lang.String key,
AttributeDescriptor<T> wildcard,
@Nullable
RandomOffset offset,
long stamp,
int limit,
Consumer<KeyValue<T>> consumer)
T - value typekey - key of the entitywildcard - wildcard attribute to scanoffset - name of attribute (including the prefix) to start fromstamp - timestamp to relatively to which retrieve the datalimit - maximal number of items to consume *consumer - the consumer to stream data todefault void listEntities(Consumer<Pair<RandomOffset,java.lang.String>> consumer)
consumer - consumer that will receive keys of entities in the random access storagevoid listEntities(@Nullable
RandomOffset offset,
int limit,
Consumer<Pair<RandomOffset,java.lang.String>> consumer)
offset - offset of the entitieslimit - limit for number of resultsconsumer - consumer of resultsEntityDescriptor getEntityDescriptor()
RandomAccessReader.Factory<?> asFactory()
RandomAccessReader.Factory suitable for serialization.RandomAccessReader.Factory representing this readerCopyright © 2017–2021. All rights reserved.