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 java.lang.Object implements TimeOrderedKeyValueBuffer<K,V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInMemoryTimeOrderedKeyValueBuffer.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 longbufferSize()voidclose()Close the storage engine.voidevictWhile(java.util.function.Supplier<java.lang.Boolean> predicate, java.util.function.Consumer<TimeOrderedKeyValueBuffer.Eviction<K,V>> callback)voidflush()Flush any cached datavoidinit(ProcessorContext context, StateStore root)Initializes this state store.booleanisOpen()Is this store open for reading and writinglongminTimestamp()java.lang.Stringname()The name of this store.intnumRecords()booleanpersistent()Return if the storage is persistent or not.Maybe<ValueAndTimestamp<V>>priorValueForBuffered(K key)voidput(long time, K key, Change<V> value, ProcessorRecordContext recordContext)voidsetSerdesIfNull(org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)java.lang.StringtoString()
-
-
-
Method Detail
-
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
-
setSerdesIfNull
public void setSerdesIfNull(org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)
- Specified by:
setSerdesIfNullin interfaceTimeOrderedKeyValueBuffer<K,V>
-
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
-
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
-
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
-
flush
public void flush()
Description copied from interface:StateStoreFlush any cached data- Specified by:
flushin interfaceStateStore
-
evictWhile
public void evictWhile(java.util.function.Supplier<java.lang.Boolean> predicate, java.util.function.Consumer<TimeOrderedKeyValueBuffer.Eviction<K,V>> callback)- Specified by:
evictWhilein interfaceTimeOrderedKeyValueBuffer<K,V>
-
priorValueForBuffered
public Maybe<ValueAndTimestamp<V>> priorValueForBuffered(K key)
- Specified by:
priorValueForBufferedin interfaceTimeOrderedKeyValueBuffer<K,V>
-
put
public void put(long time, K key, Change<V> value, ProcessorRecordContext recordContext)- Specified by:
putin interfaceTimeOrderedKeyValueBuffer<K,V>
-
numRecords
public int numRecords()
- Specified by:
numRecordsin interfaceTimeOrderedKeyValueBuffer<K,V>
-
bufferSize
public long bufferSize()
- Specified by:
bufferSizein interfaceTimeOrderedKeyValueBuffer<K,V>
-
minTimestamp
public long minTimestamp()
- Specified by:
minTimestampin interfaceTimeOrderedKeyValueBuffer<K,V>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-