Package cz.o2.proxima.direct.jdbc
Class JdbcOnlineAttributeReader
- java.lang.Object
-
- cz.o2.proxima.core.storage.AbstractStorage
-
- cz.o2.proxima.direct.jdbc.JdbcOnlineAttributeReader
-
- All Implemented Interfaces:
RandomAccessReader,java.io.Closeable,java.lang.AutoCloseable
public class JdbcOnlineAttributeReader extends AbstractStorage implements RandomAccessReader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cz.o2.proxima.core.storage.AbstractStorage
AbstractStorage.SerializableAbstractStorage
-
Nested classes/interfaces inherited from interface cz.o2.proxima.direct.core.randomaccess.RandomAccessReader
RandomAccessReader.Factory<T extends RandomAccessReader>, RandomAccessReader.GetRequest<T>, RandomAccessReader.Listing, RandomAccessReader.MultiFetch
-
-
Constructor Summary
Constructors Constructor Description JdbcOnlineAttributeReader(JdbcDataAccessor accessor, SqlStatementFactory sqlStatementFactory, EntityDescriptor entityDesc, java.net.URI uri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RandomAccessReader.Factory<?>asFactory()Convert instance of this reader toRandomAccessReader.Factorysuitable for serialization.voidclose()RandomOffsetfetchOffset(RandomAccessReader.Listing type, java.lang.String key)ConstructOffsetfrom string (representing either key of the entity or attribute).<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).voidlistEntities(RandomOffset offset, int limit, Consumer<Pair<RandomOffset,java.lang.String>> consumer)List all entity keys with offset and limit.<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.voidscanWildcardAll(java.lang.String key, RandomOffset offset, long stamp, int limit, Consumer<KeyValue<?>> consumer)Scan all data stored per given key.-
Methods inherited from class cz.o2.proxima.core.storage.AbstractStorage
equals, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cz.o2.proxima.direct.core.randomaccess.RandomAccessReader
get, get, get, get, getEntityDescriptor, listEntities, multiFetch, scanWildcard, scanWildcard, scanWildcard, scanWildcardAll, scanWildcardAll, scanWildcardAll
-
-
-
-
Constructor Detail
-
JdbcOnlineAttributeReader
public JdbcOnlineAttributeReader(JdbcDataAccessor accessor, SqlStatementFactory sqlStatementFactory, EntityDescriptor entityDesc, java.net.URI uri)
-
-
Method Detail
-
fetchOffset
public RandomOffset fetchOffset(RandomAccessReader.Listing type, java.lang.String key)
Description copied from interface:RandomAccessReaderConstructOffsetfrom 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.- Specified by:
fetchOffsetin interfaceRandomAccessReader- Parameters:
type- the type of the keykey- 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:RandomAccessReaderRetrieve data stored under given (key, attribute) pair (if any).- Specified by:
getin interfaceRandomAccessReader- Type Parameters:
T- value type- Parameters:
key- key of the entityattribute- name of the attributedesc- the attribute to search forstamp- timestamp to relatively to which retrieve the data- Returns:
- optional
KeyValueif present
-
scanWildcardAll
public void scanWildcardAll(java.lang.String key, @Nullable RandomOffset offset, long stamp, int limit, Consumer<KeyValue<?>> consumer)Description copied from interface:RandomAccessReaderScan all data stored per given key.- Specified by:
scanWildcardAllin interfaceRandomAccessReader- Parameters:
key- the key whoseKeyValues 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 scanning
-
scanWildcard
public <T> void scanWildcard(java.lang.String key, AttributeDescriptor<T> wildcard, @Nullable RandomOffset offset, long stamp, int limit, Consumer<KeyValue<T>> consumer)Description copied from interface:RandomAccessReaderList data stored for a particular wildcard attribute.- Specified by:
scanWildcardin interfaceRandomAccessReader- Type Parameters:
T- value type- Parameters:
key- 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 to
-
listEntities
public void listEntities(@Nullable RandomOffset offset, int limit, Consumer<Pair<RandomOffset,java.lang.String>> consumer)Description copied from interface:RandomAccessReaderList all entity keys with offset and limit.- Specified by:
listEntitiesin interfaceRandomAccessReader- Parameters:
offset- offset of the entitieslimit- limit for number of resultsconsumer- consumer of results
-
asFactory
public RandomAccessReader.Factory<?> asFactory()
Description copied from interface:RandomAccessReaderConvert instance of this reader toRandomAccessReader.Factorysuitable for serialization.- Specified by:
asFactoryin interfaceRandomAccessReader- Returns:
- the
RandomAccessReader.Factoryrepresenting this reader
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-