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 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 void
close()
Close the storage engine.void
flush()
Flush any cached datavoid
init(ProcessorContext context, StateStore root)
Initializes this state store.boolean
isOpen()
Is this store open for reading and writingstatic boolean
isTimestamped(StateStore stateStore)
String
name()
The name of this store.boolean
persistent()
Return if the storage is persistent or not.boolean
setFlushListener(CacheFlushListener<K,V> listener, boolean sendOldValues)
Set theCacheFlushListener
to be notified when entries are flushed from the cache to the underlyingStateStore
S
wrapped()
-
-
-
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:StateStore
Initializes 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 firstStateStore
parameter should always be the passed-inroot
object, and the second parameter should be an object of user's implementation of theStateRestoreCallback
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 extendsStateRestoreCallback
to let users implement bulk-load restoration logic instead of restoring one record at a time.- Specified by:
init
in interfaceStateStore
-
setFlushListener
public boolean setFlushListener(CacheFlushListener<K,V> listener, boolean sendOldValues)
Description copied from interface:CachedStateStore
Set theCacheFlushListener
to be notified when entries are flushed from the cache to the underlyingStateStore
- Specified by:
setFlushListener
in interfaceCachedStateStore<S extends StateStore,K>
-
name
public String name()
Description copied from interface:StateStore
The name of this store.- Specified by:
name
in interfaceStateStore
- Returns:
- the storage name
-
persistent
public boolean persistent()
Description copied from interface:StateStore
Return if the storage is persistent or not.- Specified by:
persistent
in interfaceStateStore
- Returns:
true
if the storage is persistent—false
otherwise
-
isOpen
public boolean isOpen()
Description copied from interface:StateStore
Is this store open for reading and writing- Specified by:
isOpen
in interfaceStateStore
- Returns:
true
if the store is open
-
flush
public void flush()
Description copied from interface:StateStore
Flush any cached data- Specified by:
flush
in interfaceStateStore
-
close
public void close()
Description copied from interface:StateStore
Close 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:
close
in interfaceStateStore
-
wrapped
public S wrapped()
-
-