Interface RandomAccessReader
- 
- All Superinterfaces:
- java.lang.AutoCloseable,- java.io.Closeable
 - All Known Subinterfaces:
- CachedView
 - All Known Implementing Classes:
- JdbcOnlineAttributeReader,- LocalCachedPartitionedView,- RandomHBaseReader,- TransactionalCachedView
 
 @Stable public interface RandomAccessReader extends java.io.Closeable Reader of data stored in random access storage. Every class that implements bothAbstractAttributeWriterandRandomAccessReadercan 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.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceRandomAccessReader.Factory<T extends RandomAccessReader>Serializablefactory forRandomAccessReader.static classRandomAccessReader.GetRequest<T>A wraper for a get request.static classRandomAccessReader.ListingType of listing (either listing entities of entity attributes).static interfaceRandomAccessReader.MultiFetchA facade for fetching multipleKeyValuesin single request.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description RandomAccessReader.Factory<?>asFactory()Convert instance of this reader toRandomAccessReader.Factorysuitable for serialization.RandomOffsetfetchOffset(RandomAccessReader.Listing type, java.lang.String key)ConstructOffsetfrom string (representing either key of the entity or attribute).default <T> java.util.Optional<KeyValue<T>>get(RandomAccessReader.GetRequest<T> request)Get singleKeyValueusingRandomAccessReader.GetRequest.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).EntityDescriptorgetEntityDescriptor()Retrieve entity associated with this reader.default voidlistEntities(Consumer<Pair<RandomOffset,java.lang.String>> consumer)List all entity keys.voidlistEntities(RandomOffset offset, int limit, Consumer<Pair<RandomOffset,java.lang.String>> consumer)List all entity keys with offset and limit.default RandomAccessReader.MultiFetchmultiFetch()Return a facadeRandomAccessReader.MultiFetchobject that can be used to queue multiple requests to the storage and fetch them at once usingRandomAccessReader.MultiFetch.fetch(Consumer).static MultiAccessBuildernewBuilder(Repository repo, ContextProvider context)Create a new builder that is able to constructRandomAccessReaderfrom multiple readers responsible for reading from various attribute families.default <T> voidscanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, long stamp, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.default <T> voidscanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.default <T> voidscanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, RandomOffset offset, int limit, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.<T> voidscanWildcard(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 voidscanWildcardAll(java.lang.String key, long stamp, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.default voidscanWildcardAll(java.lang.String key, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.default voidscanWildcardAll(java.lang.String key, RandomOffset offset, int limit, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.voidscanWildcardAll(java.lang.String key, RandomOffset offset, long stamp, int limit, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.
 
- 
- 
- 
Method Detail- 
newBuilderstatic MultiAccessBuilder newBuilder(Repository repo, ContextProvider context) Create a new builder that is able to constructRandomAccessReaderfrom multiple readers responsible for reading from various attribute families.- Parameters:
- repo- the- Repository
- context- direct translation context provider (e.g.- DirectDataOperator)
- Returns:
- new builder for multi random access reader
 
 - 
fetchOffsetRandomOffset fetchOffset(RandomAccessReader.Listing type, java.lang.String key) ConstructOffsetfrom string (representing either key of the entity or attribute). The returned offset represents the first element that is following the givenkey, in case of equality.- Parameters:
- type- the type of the key
- key- the key of entity or attribute
- Returns:
- offset representation of the key
 
 - 
getdefault <T> java.util.Optional<KeyValue<T>> get(java.lang.String key, AttributeDescriptor<T> desc) Retrieve data stored under given (key, attribute) pair (if any).- Type Parameters:
- T- value type
- Parameters:
- key- key of the entity
- desc- the attribute to search for (not wildcard)
- Returns:
- optional KeyValueif present
 
 - 
getdefault <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).- Type Parameters:
- T- value type
- Parameters:
- key- key of the entity
- desc- the attribute to search for (not wildcard)
- stamp- timestamp to relatively to which retrieve the data
- Returns:
- optional KeyValueif present
 
 - 
getdefault <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).- Type Parameters:
- T- value type
- Parameters:
- key- key of the entity
- attribute- name of the attribute
- desc- the attribute to search for
- Returns:
- optional KeyValueif present
 
 - 
getdefault <T> java.util.Optional<KeyValue<T>> get(RandomAccessReader.GetRequest<T> request) Get singleKeyValueusingRandomAccessReader.GetRequest.- Type Parameters:
- T- value type
- Parameters:
- request- the request
- Returns:
- optional KeyValueif present
 
 - 
get<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).- 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 KeyValueif present
 
 - 
multiFetchdefault RandomAccessReader.MultiFetch multiFetch() Return a facadeRandomAccessReader.MultiFetchobject that can be used to queue multiple requests to the storage and fetch them at once usingRandomAccessReader.MultiFetch.fetch(Consumer).- Returns:
- the RandomAccessReader.MultiFetch
 
 - 
scanWildcardAlldefault void scanWildcardAll(java.lang.String key, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.- Parameters:
- key- the key whose- KeyValues to scan
- consumer- consumer to use for scanning
 
 - 
scanWildcardAlldefault void scanWildcardAll(java.lang.String key, long stamp, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.- Parameters:
- key- the key whose- KeyValues to scan
- stamp- timestamp to relatively to which retrieve the data
- consumer- consumer to use for scanning
 
 - 
scanWildcardAlldefault void scanWildcardAll(java.lang.String key, @Nullable RandomOffset offset, int limit, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.- Parameters:
- key- the key whose- KeyValues to scan
- offset- offset to start from (next key value will be returned)
- limit- how many elements to process at most
- consumer- consumer to use for scanning
 
 - 
scanWildcardAllvoid scanWildcardAll(java.lang.String key, @Nullable RandomOffset offset, long stamp, int limit, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.- 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
 
 - 
scanWildcarddefault <T> void scanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.- Type Parameters:
- T- value type
- Parameters:
- key- key of the entity
- wildcard- wildcard attribute to scan
- consumer- the consumer to stream data to
 
 - 
scanWildcarddefault <T> void scanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, long stamp, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.- Type Parameters:
- T- value type
- Parameters:
- key- key of the entity
- wildcard- wildcard attribute to scan
- stamp- timestamp to relatively to which retrieve the data
- consumer- the consumer to stream data to
 
 - 
scanWildcarddefault <T> void scanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, @Nullable RandomOffset offset, int limit, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.- 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
- limit- maximal number of items to consume
- consumer- the consumer to stream data to
 
 - 
scanWildcard<T> void scanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, @Nullable RandomOffset offset, long stamp, int limit, Consumer<KeyValue<T>> consumer)List data stored for a particular wildcard attribute.- 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
 
 - 
listEntitiesdefault void listEntities(Consumer<Pair<RandomOffset,java.lang.String>> consumer) List all entity keys.- Parameters:
- consumer- consumer that will receive keys of entities in the random access storage
 
 - 
listEntitiesvoid listEntities(@Nullable RandomOffset offset, int limit, Consumer<Pair<RandomOffset,java.lang.String>> consumer)List all entity keys with offset and limit.- Parameters:
- offset- offset of the entities
- limit- limit for number of results
- consumer- consumer of results
 
 - 
getEntityDescriptorEntityDescriptor getEntityDescriptor() Retrieve entity associated with this reader.- Returns:
- entity associated with this reader
 
 - 
asFactoryRandomAccessReader.Factory<?> asFactory() Convert instance of this reader toRandomAccessReader.Factorysuitable for serialization.- Returns:
- the RandomAccessReader.Factoryrepresenting this reader
 
 
- 
 
-