public class RocksDBSessionStore<K,AGG> extends WrappedStateStore.AbstractStateStore implements SessionStore<K,AGG>
WrappedStateStore.AbstractStateStore
Modifier and Type | Method and Description |
---|---|
KeyValueIterator<Windowed<K>,AGG> |
fetch(K key)
Retrieve all aggregated sessions for the provided key.
|
KeyValueIterator<Windowed<K>,AGG> |
fetch(K from,
K to)
Retrieve all aggregated sessions for the given range of keys.
|
KeyValueIterator<Windowed<K>,AGG> |
findSessions(K keyFrom,
K keyTo,
long earliestSessionEndTime,
long latestSessionStartTime)
Fetch any sessions in the given range of keys and the sessions end is ≥ earliestSessionEndTime and the sessions
start is ≤ latestSessionStartTime
This iterator must be closed after use.
|
KeyValueIterator<Windowed<K>,AGG> |
findSessions(K key,
long earliestSessionEndTime,
long latestSessionStartTime)
Fetch any sessions with the matching key and the sessions end is ≥ earliestSessionEndTime and the sessions
start is ≤ latestSessionStartTime
This iterator must be closed after use.
|
void |
init(ProcessorContext context,
StateStore root)
Initializes this state store.
|
void |
put(Windowed<K> sessionKey,
AGG aggregate)
Write the aggregated value for the provided key to the store
|
void |
remove(Windowed<K> key)
Remove the session aggregated with provided
Windowed key from the store |
close, flush, inner, isOpen, name, persistent, wrappedStore
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, flush, isOpen, name, persistent
public void init(ProcessorContext context, StateStore root)
StateStore
The implementation of this function must register the root store in the context via the
ProcessorContext.register(StateStore, StateRestoreCallback)
function, where the
first StateStore
parameter should always be the passed-in root
object, and
the second parameter should be an object of user's implementation
of the StateRestoreCallback
interface used for restoring the state store from the changelog.
Note that if the state store engine itself supports bulk writes, users can implement another
interface BatchingStateRestoreCallback
which extends StateRestoreCallback
to
let users implement bulk-load restoration logic instead of restoring one record at a time.
init
in interface StateStore
init
in class WrappedStateStore.AbstractStateStore
public KeyValueIterator<Windowed<K>,AGG> findSessions(K key, long earliestSessionEndTime, long latestSessionStartTime)
SessionStore
findSessions
in interface SessionStore<K,AGG>
key
- the key to return sessions forearliestSessionEndTime
- the end timestamp of the earliest session to search forlatestSessionStartTime
- the end timestamp of the latest session to search forpublic KeyValueIterator<Windowed<K>,AGG> findSessions(K keyFrom, K keyTo, long earliestSessionEndTime, long latestSessionStartTime)
SessionStore
findSessions
in interface SessionStore<K,AGG>
keyFrom
- The first key that could be in the rangekeyTo
- The last key that could be in the rangeearliestSessionEndTime
- the end timestamp of the earliest session to search forlatestSessionStartTime
- the end timestamp of the latest session to search forpublic KeyValueIterator<Windowed<K>,AGG> fetch(K key)
ReadOnlySessionStore
fetch
in interface ReadOnlySessionStore<K,AGG>
key
- record key to find aggregated session values forpublic KeyValueIterator<Windowed<K>,AGG> fetch(K from, K to)
ReadOnlySessionStore
fetch
in interface ReadOnlySessionStore<K,AGG>
from
- first key in the range to find aggregated session values forto
- last key in the range to find aggregated session values forpublic void remove(Windowed<K> key)
SessionStore
Windowed
key from the storeremove
in interface SessionStore<K,AGG>
key
- key of the session to removepublic void put(Windowed<K> sessionKey, AGG aggregate)
SessionStore
put
in interface SessionStore<K,AGG>
sessionKey
- key of the session to writeaggregate
- the aggregated value for the session, it can be null;
if the serialized bytes are also null it is interpreted as deletes