Class KNetRocksDBConfigSetter
Extends RocksDBConfigSetter
public class KNetRocksDBConfigSetter : RocksDBConfigSetter, IDynamicMetaObjectProvider, IJVMBridgeCore, IEquatable<IJVMBridgeBase>, IDisposable, IJVMBridgeBaseStatic, IJVMBridgeBase, IJVMBridgeDefinition, IRocksDBConfigSetter
- Inheritance
-
KNetRocksDBConfigSetter
- Implements
- Inherited Members
-
JVMBridgeBase<RocksDBConfigSetter>.SExecuteWithSignature(IJavaType, string, string, params object[])JVMBridgeBase<RocksDBConfigSetter>.SExecute<TNewClass, TReturn, TConverter>(string, params object[])
Constructors
KNetRocksDBConfigSetter()
Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
[Obsolete("KNetRocksDBConfigSetter class represents, in .NET, an instance of a JVM interface or abstract class. This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public KNetRocksDBConfigSetter()
KNetRocksDBConfigSetter(IJVMBridgeBaseInitializer)
Internal constructor: used internally from JCOBridge
[Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public KNetRocksDBConfigSetter(IJVMBridgeBaseInitializer initializer)
Parameters
initializerIJVMBridgeBaseInitializer
KNetRocksDBConfigSetter(params object[])
Generic constructor: it is useful for JCOBridge when there is a derived class which needs to pass arguments to the highest JVMBridgeBase class
[Obsolete("KNetRocksDBConfigSetter class represents, in .NET, an instance of a JVM interface or abstract class. This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public KNetRocksDBConfigSetter(params object[] args)
Parameters
argsobject[]
Properties
BridgeClassName
Java class name to be instantiated
public override string BridgeClassName { get; }
Property Value
IsBridgeAbstract
true if the BridgeClassName is an abstract class, i.e. cannot be created an instance
public override bool IsBridgeAbstract { get; }
Property Value
IsBridgeInterface
true if the BridgeClassName is an interface, i.e. does not have any public constructor
public override bool IsBridgeInterface { get; }
Property Value
KNetRocksDBConfigSetterClass
The Class to be used to set the value of RocksDbConfigSetterClass or ROCKSDB_CONFIG_SETTER_CLASS_CONFIG
public static Class KNetRocksDBConfigSetterClass { get; }
Property Value
RegisteredStorageId
Current registered storage id, i.e. the list of storages where it was invoked Register(string, IRocksDbLifecycleHandler, bool)
public static IReadOnlyList<string> RegisteredStorageId { get; }
Property Value
RocksDBConfigSetterCallbackSet
true if a previous invocation of SetRocksDBConfigSetterCallback(Action<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>>, Action<string, Options, IDictionary<string, object>>) succeded
public static bool RocksDBConfigSetterCallbackSet { get; }
Property Value
Methods
Register(string, IRocksDbLifecycleHandler, bool)
Register handler associated to storageId
public static bool Register(string storageId, IRocksDbLifecycleHandler handler = null, bool silent = false)
Parameters
storageIdstringThe id used when the RocksDb storage was requested
handlerIRocksDbLifecycleHandlerThe IRocksDbLifecycleHandler will be invoked or null to use defaults
silentbooltrue to silently bypass the condition of previous registration of
storageId
Returns
Remarks
This method works only in conjunction with SetRocksDBConfigSetterCallbackDefault(), which is the default one.
Exceptions
- InvalidOperationException
If
storageIdis already registered
ResetRocksDBConfigSetterCallback()
Resets the callbacks and handler registered in SetRocksDBConfigSetterCallback(Action<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>>, Action<string, Options, IDictionary<string, object>>)
public static void ResetRocksDBConfigSetterCallback()
SetCallback(KNetRocksDBConfigSetterCallback)
Set the KNetRocksDBConfigSetterCallback used from the instances of KNetRocksDBConfigSetter
public static void SetCallback(KNetRocksDBConfigSetterCallback callback)
Parameters
callbackKNetRocksDBConfigSetterCallbackThe allocated KNetRocksDBConfigSetterCallback
SetRocksDBConfigSetterCallback(Action<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>>, Action<string, Options, IDictionary<string, object>>)
Sets the global KNetRocksDBConfigSetterCallback will be shared across all requests of KNetRocksDBConfigSetter
public static void SetRocksDBConfigSetterCallback(Action<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>> onSetConfig, Action<string, Options, IDictionary<string, object>> onClose)
Parameters
onSetConfigAction<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>>Invoked when a new KNetRocksDBConfigSetter is requested and needs to be configured: the parameters are the same of SetConfig(String, Options, Map<String, object>) with an extra parameter can be filled in with used specific information will be received back on
onCloseinvocationonCloseAction<string, Options, IDictionary<string, object>>Invoked when a previously configured instance of KNetRocksDBConfigSetter shall be closed: the parameters are the same of Close(String, Options) with an extra parameter filled in when
onSetConfigwas invoked
Remarks
The callbacks will be in effect only registering KNetRocksDBConfigSetter as Class used from RocksDbConfigSetterClass or a property associated to ROCKSDB_CONFIG_SETTER_CLASS_CONFIG:
<pre><code class="lang-csharp">StreamsConfigBuilder builder = StreamsConfigBuilder.Create();
builder.RocksDbConfigSetterClass = KNetRocksDBConfigSetter.KNetRocksDBConfigSetterClass; ... builder.Build();
In general the fourth parameter of <code class="paramref">onSetConfig</code> can be used to store the reference to objects needs to be closed when <code class="paramref">onClose</code> is invoked.
The example in <a href="https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter">https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter</a> translates into:
<pre><code class="lang-csharp">void OnSetConfig(string store, Org.Rocksdb.Options options, IKNetConfigurationFromMap configs, IDictionary<string, object> data)
{ Org.Rocksdb.Cache cache = new Org.Rocksdb.LRUCache(16 * 1024L * 1024L); data.Add("cache", cache); // See #1 in https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter. BlockBasedTableConfig tableConfig = options.TableFormatConfig().Cast<BlockBasedTableConfig>(); tableConfig.SetBlockCache(cache); // See #2 in https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter. tableConfig.SetBlockSize(16 * 1024L); // See #3 in https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter. tableConfig.SetCacheIndexAndFilterBlocks(true); options.SetTableFormatConfig(tableConfig); // See #4 in https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter. options.SetMaxWriteBufferNumber(2); }
void OnClose(string store, Org.Rocksdb.Options options, IDictionary<string, object> data) { if (data.TryGetValue("cache", out var obj) && obj is Org.Rocksdb.Cache cache) { // See #5 in https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#rocksdb-config-setter. cache.Close(); } }
Exceptions
- InvalidOperationException
If SetRocksDBConfigSetterCallback(Action<string, Options, IKNetConfigurationFromMap, IDictionary<string, object>>, Action<string, Options, IDictionary<string, object>>) is invoked twice without an invocation to ResetRocksDBConfigSetterCallback()
SetRocksDBConfigSetterCallbackDefault()
Set the default behavior; the user shall not invoked this method directly, see remarks.
public static void SetRocksDBConfigSetterCallbackDefault()
Remarks
Default behavior is set by default; this method can be used if the user invoked ResetRocksDBConfigSetterCallback() and needs to return to the default
Unregister(string, bool)
Unregister the IRocksDbLifecycleHandler associated to storageId
public static bool Unregister(string storageId, bool silent = false)
Parameters
storageIdstringThe id used when the RocksDb storage was requested
silentbooltrue to silently bypass the condition of missing registration of
storageId
Returns
Remarks
This method works only in conjunction with SetRocksDBConfigSetterCallbackDefault(), which is the default one.
Exceptions
- InvalidOperationException
If
storageIdis not available