public class ChangeLoggingKeyValueBytesStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
WrappedStateStore.AbstractStateStore
Modifier and Type | Method and Description |
---|---|
KeyValueIterator<org.apache.kafka.common.utils.Bytes,byte[]> |
all()
Return an iterator over all keys in this store.
|
long |
approximateNumEntries()
Return an approximate count of key-value mappings in this store.
|
byte[] |
delete(org.apache.kafka.common.utils.Bytes key)
Delete the value from the store (if there is one).
|
byte[] |
get(org.apache.kafka.common.utils.Bytes key)
Get the value corresponding to this key.
|
void |
init(ProcessorContext context,
StateStore root)
Initializes this state store.
|
void |
put(org.apache.kafka.common.utils.Bytes key,
byte[] value)
Update the value associated with this key.
|
void |
putAll(java.util.List<KeyValue<org.apache.kafka.common.utils.Bytes,byte[]>> entries)
Update all the given key/value pairs.
|
byte[] |
putIfAbsent(org.apache.kafka.common.utils.Bytes key,
byte[] value)
Update the value associated with this key, unless a value is already associated with the key.
|
KeyValueIterator<org.apache.kafka.common.utils.Bytes,byte[]> |
range(org.apache.kafka.common.utils.Bytes from,
org.apache.kafka.common.utils.Bytes to)
Get an iterator over a given range of keys.
|
close, flush, inner, isOpen, name, persistent, wrappedStore
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, flush, isOpen, name, persistent
public void init(ProcessorContext context, StateStore root)
StateStore
The implementation of this function must register the root store in the context via the
ProcessorContext.register(StateStore, StateRestoreCallback)
function, where the
first StateStore
parameter should always be the passed-in root
object, and
the second parameter should be an object of user's implementation
of the StateRestoreCallback
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 extends StateRestoreCallback
to
let users implement bulk-load restoration logic instead of restoring one record at a time.
init
in interface StateStore
init
in class WrappedStateStore.AbstractStateStore
public long approximateNumEntries()
ReadOnlyKeyValueStore
approximateNumEntries
in interface ReadOnlyKeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
public void put(org.apache.kafka.common.utils.Bytes key, byte[] value)
KeyValueStore
put
in interface KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
key
- The key to associate the value tovalue
- The value to update, it can be null
;
if the serialized bytes are also null
it is interpreted as deletespublic byte[] putIfAbsent(org.apache.kafka.common.utils.Bytes key, byte[] value)
KeyValueStore
putIfAbsent
in interface KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
key
- The key to associate the value tovalue
- The value to update, it can be null
;
if the serialized bytes are also null
it is interpreted as deletesnull
if there is no such key.public void putAll(java.util.List<KeyValue<org.apache.kafka.common.utils.Bytes,byte[]>> entries)
KeyValueStore
putAll
in interface KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
entries
- A list of entries to put into the store;
if the serialized bytes are also null
it is interpreted as deletespublic byte[] delete(org.apache.kafka.common.utils.Bytes key)
KeyValueStore
delete
in interface KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
key
- The keynull
if there is no such key.public byte[] get(org.apache.kafka.common.utils.Bytes key)
ReadOnlyKeyValueStore
get
in interface ReadOnlyKeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
key
- The key to fetchpublic KeyValueIterator<org.apache.kafka.common.utils.Bytes,byte[]> range(org.apache.kafka.common.utils.Bytes from, org.apache.kafka.common.utils.Bytes to)
ReadOnlyKeyValueStore
ConcurrentModificationException
s
and must not return null values. No ordering guarantees are provided.range
in interface ReadOnlyKeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>
from
- The first key that could be in the rangeto
- The last key that could be in the rangepublic KeyValueIterator<org.apache.kafka.common.utils.Bytes,byte[]> all()
ReadOnlyKeyValueStore
ConcurrentModificationException
s
and must not return null values. No ordering guarantees are provided.all
in interface ReadOnlyKeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>