Interface IRocksDbLifecycleHandler
Defines the RocksDB lifecycle callbacks invoked by KEFCore for a Kafka Streams state store.
public interface IRocksDbLifecycleHandler
Remarks
Implementations are resolved once during bootstrap and then reused from the storage-id runtime map, so they should be thread-safe.
Methods
OnClose(Options, IDictionary<string, object>)
Invoked when RocksDB is closing the state store associated to the current entity storage.
void OnClose(Options options, IDictionary<string, object> data)
Parameters
optionsOptionsThe RocksDB Options instance associated to the store.
dataIDictionary<string, object>The same per-store dictionary previously provided to OnSetConfig(Options, IKNetConfigurationFromMap, IDictionary<string, object>).
Remarks
Implementations should retrieve from data any resource created during
OnSetConfig(Options, IKNetConfigurationFromMap, IDictionary<string, object>)
and dispose it explicitly if needed.
OnSetConfig(Options, IKNetConfigurationFromMap, IDictionary<string, object>)
Invoked when RocksDB is configuring the state store associated to the current entity storage.
void OnSetConfig(Options options, IKNetConfigurationFromMap configuration, IDictionary<string, object> data)
Parameters
optionsOptionsThe RocksDB Options instance to be configured.
configurationIKNetConfigurationFromMapThe KNet IKNetConfigurationFromMap map associated to the callback.
dataIDictionary<string, object>A per-store dictionary used to keep managed objects alive for the whole lifetime of the underlying RocksDB store instance.
Remarks
Any managed object created during configuration and referenced natively by RocksDB
(for example LRUCache, BlockBasedTableConfig, or similar objects)
must be stored in data. Otherwise the .NET GC may collect it while
RocksDB is still holding the native reference, causing non-deterministic crashes.
The same dictionary instance is later passed back to OnClose(Options, IDictionary<string, object>), so implementations can retrieve and explicitly dispose the resources that were stored here.