K
- type of the record keysAGG
- type of the aggregated valuespublic interface SessionStore<K,AGG> extends StateStore, ReadOnlySessionStore<K,AGG>
The key is internally represented as Windowed<K>
that comprises the plain
key and the Window
that represents window start- and end-timestamp.
If two sessions are merged, a new session with new start- and end-timestamp must be inserted into the store while the two old sessions must be deleted.
Modifier and Type | Method and Description |
---|---|
default KeyValueIterator<Windowed<K>,AGG> |
backwardFindSessions(K key,
Instant earliestSessionEndTime,
Instant latestSessionStartTime)
Fetch any sessions with the matching key and the sessions end is ≥ earliestSessionEndTime
and the sessions start is ≤ latestSessionStartTime iterating from latest to earliest.
|
default KeyValueIterator<Windowed<K>,AGG> |
backwardFindSessions(K keyFrom,
K keyTo,
Instant earliestSessionEndTime,
Instant latestSessionStartTime)
Fetch any sessions in the given range of keys and the sessions end is ≥
earliestSessionEndTime and the sessions start is ≤ latestSessionStartTime iterating from
latest to earliest.
|
default AGG |
fetchSession(K key,
Instant sessionStartTime,
Instant sessionEndTime)
Get the value of key from a single session.
|
default KeyValueIterator<Windowed<K>,AGG> |
findSessions(K key,
Instant earliestSessionEndTime,
Instant latestSessionStartTime)
Fetch any sessions with the matching key and the sessions end is ≥ earliestSessionEndTime
and the sessions start is ≤ latestSessionStartTime iterating from earliest to latest.
|
default KeyValueIterator<Windowed<K>,AGG> |
findSessions(K keyFrom,
K keyTo,
Instant earliestSessionEndTime,
Instant latestSessionStartTime)
Fetch any sessions in the given range of keys and the sessions end is ≥
earliestSessionEndTime and the sessions start is ≤ latestSessionStartTime iterating from
earliest to latest.
|
default KeyValueIterator<Windowed<K>,AGG> |
findSessions(long earliestSessionEndTime,
long latestSessionEndTime)
Return all the session window entries that ends between the specified range (both ends are inclusive).
|
void |
put(Windowed<K> sessionKey,
AGG aggregate)
Write the aggregated value for the provided key to the store
|
void |
remove(Windowed<K> sessionKey)
Remove the session aggregated with provided
Windowed key from the store |
close, flush, getPosition, init, init, isOpen, name, persistent, query
backwardFetch, backwardFetch, backwardFindSessions, backwardFindSessions, fetch, fetch, fetchSession, findSessions, findSessions
default KeyValueIterator<Windowed<K>,AGG> findSessions(long earliestSessionEndTime, long latestSessionEndTime)
earliestSessionEndTime
- earliest session end time to search from, inclusivelatestSessionEndTime
- latest session end time to search to, inclusivedefault KeyValueIterator<Windowed<K>,AGG> findSessions(K key, Instant earliestSessionEndTime, Instant latestSessionStartTime)
ReadOnlySessionStore
earliestSessionEndTime: ESET
latestSessionStartTime: LSST
[ESET............LSST]
[not-included] [included] [included] [included] [not-included]
This iterator must be closed after use.
findSessions
in interface ReadOnlySessionStore<K,AGG>
key
- the key to return sessions forearliestSessionEndTime
- the end timestamp of the earliest session to search for, where
iteration starts.latestSessionStartTime
- the end timestamp of the latest session to search for, where
iteration ends.default KeyValueIterator<Windowed<K>,AGG> backwardFindSessions(K key, Instant earliestSessionEndTime, Instant latestSessionStartTime)
ReadOnlySessionStore
earliestSessionEndTime: ESET
latestSessionStartTime: LSST
[ESET............LSST]
[not-included] [included] [included] [included] [not-included]
This iterator must be closed after use.
backwardFindSessions
in interface ReadOnlySessionStore<K,AGG>
key
- the key to return sessions forearliestSessionEndTime
- the end timestamp of the earliest session to search for, where
iteration ends.latestSessionStartTime
- the end timestamp of the latest session to search for, where
iteration starts.default KeyValueIterator<Windowed<K>,AGG> findSessions(K keyFrom, K keyTo, Instant earliestSessionEndTime, Instant latestSessionStartTime)
ReadOnlySessionStore
earliestSessionEndTime: ESET
latestSessionStartTime: LSST
[ESET............LSST]
[not-included] [included] [included] [included] [not-included]
This iterator must be closed after use.
findSessions
in interface ReadOnlySessionStore<K,AGG>
keyFrom
- The first key that could be in the range
A null value indicates a starting position from the first element in the store.keyTo
- The last key that could be in the range
A null value indicates that the range ends with the last element in the store.earliestSessionEndTime
- the end timestamp of the earliest session to search for, where
iteration starts.latestSessionStartTime
- the end timestamp of the latest session to search for, where
iteration ends.default KeyValueIterator<Windowed<K>,AGG> backwardFindSessions(K keyFrom, K keyTo, Instant earliestSessionEndTime, Instant latestSessionStartTime)
ReadOnlySessionStore
earliestSessionEndTime: ESET
latestSessionStartTime: LSST
[ESET............LSST]
[not-included] [included] [included] [included] [not-included]
This iterator must be closed after use.
backwardFindSessions
in interface ReadOnlySessionStore<K,AGG>
keyFrom
- The first key that could be in the range
A null value indicates a starting position from the first element in the store.keyTo
- The last key that could be in the range
A null value indicates that the range ends with the last element in the store.earliestSessionEndTime
- the end timestamp of the earliest session to search for, where
iteration ends.latestSessionStartTime
- the end timestamp of the latest session to search for, where
iteration starts.default AGG fetchSession(K key, Instant sessionStartTime, Instant sessionEndTime)
ReadOnlySessionStore
fetchSession
in interface ReadOnlySessionStore<K,AGG>
key
- the key to fetchsessionStartTime
- start timestamp of the sessionsessionEndTime
- end timestamp of the sessionnull
if no session with the exact start and end timestamp exists
for the given keyvoid remove(Windowed<K> sessionKey)
Windowed
key from the storesessionKey
- key of the session to removeNullPointerException
- If null is used for sessionKey.void put(Windowed<K> sessionKey, AGG aggregate)
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 deletesNullPointerException
- If null is used for sessionKey.