Skip to content

Latest commit

 

History

History
112 lines (70 loc) · 4.1 KB

kafka-streams-internals-CachingKeyValueStore.adoc

File metadata and controls

112 lines (70 loc) · 4.1 KB

CachingKeyValueStore

CachingKeyValueStore is a concrete KeyValueStore of Bytes keys and byte[] values (i.e. KeyValueStore<Bytes, byte[]>).

CachingKeyValueStore is also a concrete WrappedStateStore of KeyValueStore of Bytes keys and byte[] values (i.e. WrappedStateStore<KeyValueStore<Bytes, byte[]>, byte[], byte[]>).

CachingKeyValueStore is a concrete CachedStateStore.

CachingKeyValueStore is created when:

CachingKeyValueStore takes a single KeyValueStore (underlying state store) to be created.

Initializing State Store — init Method

void init(
  ProcessorContext context,
  StateStore root)
Note
init is part of the StateStore Contract to initialize the state store.

init then requests the underlying KeyValueStore to initialize.

In the end, init saves the current thread as the streamThread internal registry.

initInternal Internal Method

void initInternal(ProcessorContext context)

initInternal saves the ProcessorContext as the context internal registry.

initInternal requests the InternalProcessorContext for a ThreadCache that is saved as the cache internal registry.

initInternal creates the name of the cache for the task ID and the store name and that is saved as the cacheName internal registry.

In the end, initInternal requests the ThreadCache to addDirtyEntryFlushListener with the cache name and a DirtyEntryFlushListener that simply putAndMaybeForward the DirtyEntries.

Note
initInternal is used exclusively when CachingKeyValueStore is requested to initialize.

putAndMaybeForward Internal Method

void putAndMaybeForward(
  ThreadCache.DirtyEntry entry,
  InternalProcessorContext context)

putAndMaybeForward…​FIXME

Note
putAndMaybeForward is used exclusively when CachingKeyValueStore is requested to initialize (via initInternal).

remove Method

void remove(final Windowed<Bytes> sessionKey)
Note
remove is part of SessionStore Contract to…​FIXME.

remove…​FIXME

Closing State Store — close Method

void close()
Note
close is part of…​FIXME

close…​FIXME

Internal Properties

Name Description

cache

Used when…​FIXME

cacheName

context

Used when…​FIXME

streamThread

Thread

Used when…​FIXME