Class WrappedStateStore<S extends StateStore,K,V>
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.WrappedStateStore<S,K,V>
-
- All Implemented Interfaces:
StateStore,CachedStateStore<K,V>
- Direct Known Subclasses:
CachingKeyValueStore,ChangeLoggingKeyValueBytesStore,MeteredKeyValueStore,MeteredSessionStore,MeteredWindowStore,RocksDBSessionStore,RocksDBWindowStore
public abstract class WrappedStateStore<S extends StateStore,K,V> extends java.lang.Object implements StateStore, CachedStateStore<K,V>
A storage engine wrapper for utilities like logging, caching, and metering.
-
-
Constructor Summary
Constructors Constructor Description WrappedStateStore(S wrapped)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the storage engine.voidflush()Flush any cached datavoidinit(ProcessorContext context, StateStore root)Initializes this state store.booleanisOpen()Is this store open for reading and writingstatic booleanisTimestamped(StateStore stateStore)java.lang.Stringname()The name of this store.booleanpersistent()Return if the storage is persistent or not.booleansetFlushListener(CacheFlushListener<K,V> listener, boolean sendOldValues)Set theCacheFlushListenerto be notified when entries are flushed from the cache to the underlyingStateStoreSwrapped()
-
-
-
Constructor Detail
-
WrappedStateStore
public WrappedStateStore(S wrapped)
-
-
Method Detail
-
isTimestamped
public static boolean isTimestamped(StateStore stateStore)
-
init
public void init(ProcessorContext context, StateStore root)
Description copied from interface:StateStoreInitializes this state store.The implementation of this function must register the root store in the context via the
ProcessorContext.register(StateStore, StateRestoreCallback)function, where the firstStateStoreparameter should always be the passed-inrootobject, and the second parameter should be an object of user's implementation of theStateRestoreCallbackinterface 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
BatchingStateRestoreCallbackwhich extendsStateRestoreCallbackto let users implement bulk-load restoration logic instead of restoring one record at a time.- Specified by:
initin interfaceStateStore
-
setFlushListener
public boolean setFlushListener(CacheFlushListener<K,V> listener, boolean sendOldValues)
Description copied from interface:CachedStateStoreSet theCacheFlushListenerto be notified when entries are flushed from the cache to the underlyingStateStore- Specified by:
setFlushListenerin interfaceCachedStateStore<S extends StateStore,K>
-
name
public java.lang.String name()
Description copied from interface:StateStoreThe name of this store.- Specified by:
namein interfaceStateStore- Returns:
- the storage name
-
persistent
public boolean persistent()
Description copied from interface:StateStoreReturn if the storage is persistent or not.- Specified by:
persistentin interfaceStateStore- Returns:
trueif the storage is persistent—falseotherwise
-
isOpen
public boolean isOpen()
Description copied from interface:StateStoreIs this store open for reading and writing- Specified by:
isOpenin interfaceStateStore- Returns:
trueif the store is open
-
flush
public void flush()
Description copied from interface:StateStoreFlush any cached data- Specified by:
flushin interfaceStateStore
-
close
public void close()
Description copied from interface:StateStoreClose the storage engine. Note that this function needs to be idempotent since it may be called several times on the same state store.Users only need to implement this function but should NEVER need to call this api explicitly as it will be called by the library automatically when necessary
- Specified by:
closein interfaceStateStore
-
wrapped
public S wrapped()
-
-