Table of Contents

Interface IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

Namespace
MASES.KNet.Replicator
Assembly
MASES.KNet.dll
public interface IKNetCompactedReplicator<K, V, TJVMK, TJVMV> : IDictionary<K, V>, ICollection<KeyValuePair<K, V>>, IEnumerable<KeyValuePair<K, V>>, IEnumerable, IDisposable where V : class

Type Parameters

K

The type of keys in the dictionary

V

The type of values in the dictionary. Must be a nullable type

TJVMK

The JVM type of K

TJVMV

The JVM type of V

Inherited Members

Properties

AccessRights

Get or set AccessRightsType

AccessRightsType AccessRights { get; }

Property Value

AccessRightsType

BootstrapServers

Get or set bootstrap servers

string BootstrapServers { get; }

Property Value

string

ConsumePollTimeout

Get or set the poll timeout to be used for ConsumeAsync(long)

long ConsumePollTimeout { get; }

Property Value

long

ConsumerConfig

ConsumerConfigBuilder ConsumerConfig { get; }

Property Value

ConsumerConfigBuilder

ConsumerInstances

Get or set the number of KNetConsumer<K, V, TJVMK, TJVMV> instances to be used, null to allocate KNetConsumer<K, V, TJVMK, TJVMV> based on Partitions

int? ConsumerInstances { get; }

Property Value

int?

CurrentConsumersSyncState

Reports a snapshot of current sync state the value (true means it is in sync) associated to each consumer (the key).

IReadOnlyDictionary<int, bool> CurrentConsumersSyncState { get; }

Property Value

IReadOnlyDictionary<int, bool>

Remarks

It is only a snapshot when the property is read and cannot reflect real conditions

CurrentPartitionLags

Reports a snapshot of current lags (the value) associated to each partition (the key).

IReadOnlyDictionary<int, long> CurrentPartitionLags { get; }

Property Value

IReadOnlyDictionary<int, long>

Remarks

It is only a snapshot when the property is read and cannot reflect real conditions

GroupId

Get or set the group id, if not set a value is generated

string GroupId { get; }

Property Value

string

IsAssigned

true if the instance was started

bool IsAssigned { get; }

Property Value

bool

IsStarted

true if the instance was started

bool IsStarted { get; }

Property Value

bool

KeySerDes

Get or set an instance of ISerDes<T, TJVMT> to use in KNetCompactedReplicator<K, V, TJVMK, TJVMV>, by default it creates a default one based on K

ISerDes<K, TJVMK> KeySerDes { get; }

Property Value

ISerDes<K, TJVMK>

KeySerDesSelector

The Type used to create an instance of KeySerDes"/>

Type KeySerDesSelector { get; }

Property Value

Type

OnDelayedStore

It is called to request if the [K, V] can be stored in the IKNetCompactedReplicator<K, V, TJVMK, TJVMV> instance.

Func<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, bool, KeyValuePair<K, V>, bool> OnDelayedStore { get; }

Property Value

Func<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, bool, KeyValuePair<K, V>, bool>

Remarks

The second parameter reports the current value that depends on values set to UpdateMode and if it contains the Delayed

Partitions

Get or set partitions to use when topic is created for the first time, otherwise reports the partiions of the topic

int Partitions { get; }

Property Value

int

ProducerConfig

ProducerConfigBuilder ProducerConfig { get; }

Property Value

ProducerConfigBuilder

ReplicationFactor

Get or set replication factor to use when topic is created for the first time, otherwise reports the replication factor of the topic

short ReplicationFactor { get; }

Property Value

short

StateName

Get or set topic name

string StateName { get; }

Property Value

string

TopicConfig

Get or set TopicConfigBuilder to use when topic is created for the first time

TopicConfigBuilder TopicConfig { get; }

Property Value

TopicConfigBuilder

UpdateMode

Get or set UpdateModeTypes

UpdateModeTypes UpdateMode { get; }

Property Value

UpdateModeTypes

ValueSerDes

Get or set an instance of ISerDes<T, TJVMT> to use in KNetCompactedReplicator<K, V, TJVMK, TJVMV>, by default it creates a default one based on V

ISerDes<V, TJVMV> ValueSerDes { get; }

Property Value

ISerDes<V, TJVMV>

ValueSerDesSelector

The Type used to create an instance of ValueSerDes"/>

Type ValueSerDesSelector { get; }

Property Value

Type

Methods

ConsumerMetrics<TMetric>()

IReadOnlyDictionary<int, Map<MetricName, TMetric>> ConsumerMetrics<TMetric>() where TMetric : Metric

Returns

IReadOnlyDictionary<int, Map<MetricName, TMetric>>

An IReadOnlyDictionary<TKey, TValue> where the key is the current allocated KNetConsumer<K, V, TJVMK, TJVMV> and value is a Map of MetricName and TMetric

Type Parameters

TMetric

Extends Metric

Flush()

Waits until all outstanding produce requests and delivery report callbacks are completed

void Flush()

ProducerMetrics<TMetric>()

Map<MetricName, TMetric> ProducerMetrics<TMetric>() where TMetric : Metric

Returns

Map<MetricName, TMetric>

A Map of MetricName and TMetric

Type Parameters

TMetric

Extends Metric

Start()

Start this KNetCompactedReplicator<K, V, TJVMK, TJVMV>: create the StateName topic if not available, allocates Producer and Consumer, sets serializer/deserializer

void Start()

Exceptions

InvalidOperationException

Some errors occurred

StartAndWait(int)

Start this KNetCompactedReplicator<K, V, TJVMK, TJVMV>: create the StateName topic if not available, allocates Producer and Consumers, sets serializer/deserializer Then waits its synchronization with StateName topic which stores dictionary data

bool StartAndWait(int timeout = -1)

Parameters

timeout int

The number of milliseconds to wait, or Infinite to wait indefinitely

Returns

bool

true if the current instance synchronize within the given timeout; otherwise, false

Exceptions

InvalidOperationException

Some errors occurred or the provided AccessRights do not include the Read flag

SyncWait(int)

Waits that KNetCompactedReplicator<K, V, TJVMK, TJVMV> is synchronized to the StateName topic which stores dictionary data

bool SyncWait(int timeout = -1)

Parameters

timeout int

The number of milliseconds to wait, or Infinite to wait indefinitely

Returns

bool

true if the current instance synchronize within the given timeout; otherwise, false

Exceptions

InvalidOperationException

The provided AccessRights do not include the Read flag

WaitForStateAssignment(int)

Waits for all paritions assignment of the StateName topic which stores dictionary data

bool WaitForStateAssignment(int timeout = -1)

Parameters

timeout int

The number of milliseconds to wait, or Infinite to wait indefinitely

Returns

bool

true if the current instance receives a signal within the given timeout; otherwise, false

Exceptions

InvalidOperationException

The provided AccessRights do not include the Read flag

Events

OnLocalAdd

Called when a [K, V] is added on this IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnLocalAdd

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>

OnLocalRemove

Called when a [K, V] is removed from this IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnLocalRemove

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>

OnLocalUpdate

Called when a [K, V] is updated on this IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnLocalUpdate

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>

OnRemoteAdd

Called when a [K, V] is added by consuming data from the others IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnRemoteAdd

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>

OnRemoteRemove

Called when a [K, V] is removed by consuming data from the others IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnRemoteRemove

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>

OnRemoteUpdate

Called when a [K, V] is updated by consuming data from the others IKNetCompactedReplicator<K, V, TJVMK, TJVMV>

event Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>> OnRemoteUpdate

Event Type

Action<IKNetCompactedReplicator<K, V, TJVMK, TJVMV>, KeyValuePair<K, V>>