Class InMemoryTimeOrderedKeyValueBuffer<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.InMemoryTimeOrderedKeyValueBuffer<K,V>
-
- All Implemented Interfaces:
StateStore
,TimeOrderedKeyValueBuffer<K,V>
public final class InMemoryTimeOrderedKeyValueBuffer<K,V> extends Object implements TimeOrderedKeyValueBuffer<K,V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InMemoryTimeOrderedKeyValueBuffer.Builder<K,V>
-
Nested classes/interfaces inherited from interface org.apache.kafka.streams.state.internals.TimeOrderedKeyValueBuffer
TimeOrderedKeyValueBuffer.Eviction<K,V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
bufferSize()
void
close()
Close the storage engine.void
evictWhile(Supplier<Boolean> predicate, Consumer<TimeOrderedKeyValueBuffer.Eviction<K,V>> callback)
void
flush()
Flush any cached datavoid
init(ProcessorContext context, StateStore root)
Initializes this state store.boolean
isOpen()
Is this store open for reading and writinglong
minTimestamp()
String
name()
The name of this store.int
numRecords()
boolean
persistent()
Return if the storage is persistent or not.Maybe<ValueAndTimestamp<V>>
priorValueForBuffered(K key)
void
put(long time, K key, Change<V> value, ProcessorRecordContext recordContext)
void
setSerdesIfNull(Serde<K> keySerde, Serde<V> valueSerde)
String
toString()
-
-
-
Method Detail
-
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
-
setSerdesIfNull
public void setSerdesIfNull(Serde<K> keySerde, Serde<V> valueSerde)
- Specified by:
setSerdesIfNull
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
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
-
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
-
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
-
flush
public void flush()
Description copied from interface:StateStore
Flush any cached data- Specified by:
flush
in interfaceStateStore
-
evictWhile
public void evictWhile(Supplier<Boolean> predicate, Consumer<TimeOrderedKeyValueBuffer.Eviction<K,V>> callback)
- Specified by:
evictWhile
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
priorValueForBuffered
public Maybe<ValueAndTimestamp<V>> priorValueForBuffered(K key)
- Specified by:
priorValueForBuffered
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
put
public void put(long time, K key, Change<V> value, ProcessorRecordContext recordContext)
- Specified by:
put
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
numRecords
public int numRecords()
- Specified by:
numRecords
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
bufferSize
public long bufferSize()
- Specified by:
bufferSize
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
minTimestamp
public long minTimestamp()
- Specified by:
minTimestamp
in interfaceTimeOrderedKeyValueBuffer<K,V>
-
-