Class RocksDBSessionStore
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.WrappedStateStore<SegmentedBytesStore,java.lang.Object,java.lang.Object>
-
- org.apache.kafka.streams.state.internals.RocksDBSessionStore
-
- All Implemented Interfaces:
StateStore,CachedStateStore<java.lang.Object,java.lang.Object>,ReadOnlySessionStore<org.apache.kafka.common.utils.Bytes,byte[]>,SessionStore<org.apache.kafka.common.utils.Bytes,byte[]>
public class RocksDBSessionStore extends WrappedStateStore<SegmentedBytesStore,java.lang.Object,java.lang.Object> implements SessionStore<org.apache.kafka.common.utils.Bytes,byte[]>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]>fetch(org.apache.kafka.common.utils.Bytes key)Retrieve all aggregated sessions for the provided key.KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]>fetch(org.apache.kafka.common.utils.Bytes from, org.apache.kafka.common.utils.Bytes to)Retrieve all aggregated sessions for the given range of keys.byte[]fetchSession(org.apache.kafka.common.utils.Bytes key, long startTime, long endTime)Get the value of key from a single session.KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]>findSessions(org.apache.kafka.common.utils.Bytes 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.KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]>findSessions(org.apache.kafka.common.utils.Bytes keyFrom, org.apache.kafka.common.utils.Bytes 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.voidput(Windowed<org.apache.kafka.common.utils.Bytes> sessionKey, byte[] aggregate)Write the aggregated value for the provided key to the storevoidremove(Windowed<org.apache.kafka.common.utils.Bytes> key)Remove the session aggregated with providedWindowedkey from the store-
Methods inherited from class org.apache.kafka.streams.state.internals.WrappedStateStore
close, flush, init, isOpen, isTimestamped, name, persistent, setFlushListener, wrapped
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.kafka.streams.processor.StateStore
close, flush, init, isOpen, name, persistent
-
-
-
-
Method Detail
-
findSessions
public KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]> findSessions(org.apache.kafka.common.utils.Bytes key, long earliestSessionEndTime, long latestSessionStartTime)
Description copied from interface:SessionStoreFetch 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.- Specified by:
findSessionsin interfaceSessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
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 for- Returns:
- iterator of sessions with the matching key and aggregated values
-
findSessions
public KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]> findSessions(org.apache.kafka.common.utils.Bytes keyFrom, org.apache.kafka.common.utils.Bytes keyTo, long earliestSessionEndTime, long latestSessionStartTime)
Description copied from interface:SessionStoreFetch 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.- Specified by:
findSessionsin interfaceSessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
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 for- Returns:
- iterator of sessions with the matching keys and aggregated values
-
fetchSession
public byte[] fetchSession(org.apache.kafka.common.utils.Bytes key, long startTime, long endTime)Description copied from interface:SessionStoreGet the value of key from a single session.- Specified by:
fetchSessionin interfaceSessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
key- the key to fetchstartTime- start timestamp of the sessionendTime- end timestamp of the session- Returns:
- The value or
nullif no session associated with the key can be found
-
fetch
public KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]> fetch(org.apache.kafka.common.utils.Bytes key)
Description copied from interface:ReadOnlySessionStoreRetrieve all aggregated sessions for the provided key. This iterator must be closed after use. For each key, the iterator guarantees ordering of sessions, starting from the oldest/earliest available session to the newest/latest session.- Specified by:
fetchin interfaceReadOnlySessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
key- record key to find aggregated session values for- Returns:
- KeyValueIterator containing all sessions for the provided key.
-
fetch
public KeyValueIterator<Windowed<org.apache.kafka.common.utils.Bytes>,byte[]> fetch(org.apache.kafka.common.utils.Bytes from, org.apache.kafka.common.utils.Bytes to)
Description copied from interface:ReadOnlySessionStoreRetrieve all aggregated sessions for the given range of keys. This iterator must be closed after use. For each key, the iterator guarantees ordering of sessions, starting from the oldest/earliest available session to the newest/latest session.- Specified by:
fetchin interfaceReadOnlySessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
from- first key in the range to find aggregated session values forto- last key in the range to find aggregated session values for- Returns:
- KeyValueIterator containing all sessions for the provided key.
-
remove
public void remove(Windowed<org.apache.kafka.common.utils.Bytes> key)
Description copied from interface:SessionStoreRemove the session aggregated with providedWindowedkey from the store- Specified by:
removein interfaceSessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
key- key of the session to remove
-
put
public void put(Windowed<org.apache.kafka.common.utils.Bytes> sessionKey, byte[] aggregate)
Description copied from interface:SessionStoreWrite the aggregated value for the provided key to the store- Specified by:
putin interfaceSessionStore<org.apache.kafka.common.utils.Bytes,byte[]>- Parameters:
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
-
-