KeyValueStore<K,V>
, SessionStore<K,AGG>
, WindowStore<K,V>
public interface StateStore
If the store is implemented as a persistent store, it must use the store name as directory name and write
all data into this store directory.
The store directory must be created with the state directory.
The state directory can be obtained via #stateDir()
using the
ProcessorContext
provided via init(...)
.
Using nested store directories within the state directory isolates different state stores. If a state store would write into the state directory directly, it might conflict with others state stores and thus, data might get corrupted and/or Streams might fail with an error. Furthermore, Kafka Streams relies on using the store name as store directory name to perform internal cleanup tasks.
This interface does not specify any query capabilities, which, of course, would be query engine specific. Instead it just specifies the minimum functionality required to reload a storage engine from its changelog as well as basic lifecycle management.
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Close the storage engine.
|
void |
flush() |
Flush any cached data
|
void |
init(ProcessorContext context,
StateStore root) |
Initializes this state store
|
boolean |
isOpen() |
Is this store open for reading and writing
|
java.lang.String |
name() |
The name of this store.
|
boolean |
persistent() |
Return if the storage is persistent or not.
|
java.lang.String name()
void init(ProcessorContext context, StateStore root)
java.lang.IllegalStateException
- If store gets registered after initialized is already finishedStreamsException
- if the store's change log does not contain the partitionvoid flush()
void close()
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
boolean persistent()
true
if the storage is persistent—false
otherwiseboolean isOpen()
true
if the store is open