Table of Contents

Class KEFCoreCluster

Namespace
MASES.EntityFrameworkCore.KNet.Storage.Internal
Assembly
MASES.EntityFrameworkCore.KNet.dll

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public class KEFCoreCluster : IKEFCoreCluster, IDisposable
Inheritance
KEFCoreCluster
Implements
Inherited Members

Remarks

Default initializer

Constructors

KEFCoreCluster(KEFCoreOptionsExtension, IDiagnosticsLogger<Infrastructure>, IKEFCoreTableFactory, IValueGeneratorSelector, IComplexTypeConverterFactory)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public KEFCoreCluster(KEFCoreOptionsExtension options, IDiagnosticsLogger<DbLoggerCategory.Infrastructure> infrastructureLogger, IKEFCoreTableFactory tableFactory, IValueGeneratorSelector valueGeneratorSelector, IComplexTypeConverterFactory complexTypeConverterFactory)

Parameters

options KEFCoreOptionsExtension
infrastructureLogger IDiagnosticsLogger<DbLoggerCategory.Infrastructure>
tableFactory IKEFCoreTableFactory
valueGeneratorSelector IValueGeneratorSelector
complexTypeConverterFactory IComplexTypeConverterFactory

Remarks

Default initializer

Properties

ClusterId

The Apche Kafka cluster identifier

public virtual string ClusterId { get; }

Property Value

string

ComplexTypeConverterFactory

public virtual IComplexTypeConverterFactory ComplexTypeConverterFactory { get; }

Property Value

IComplexTypeConverterFactory

InfrastructureLogger

public virtual IDiagnosticsLogger<DbLoggerCategory.Infrastructure> InfrastructureLogger { get; }

Property Value

IDiagnosticsLogger<DbLoggerCategory.Infrastructure>

ValueGeneratorSelector

public virtual IValueGeneratorSelector ValueGeneratorSelector { get; }

Property Value

IValueGeneratorSelector

Methods

AbortTransactions(string)

Calls AbortTransaction() on the transactional producer for transactionGroup, then calls AbortPendingOffsets() on all IEntityTypeProducer registered in the group.

public void AbortTransactions(string transactionGroup)

Parameters

transactionGroup string

BeginTransactions(string)

Calls BeginTransaction() on the transactional producer for transactionGroup.

public void BeginTransactions(string transactionGroup)

Parameters

transactionGroup string

CommitTransactions(string)

Calls CommitTransaction() on the transactional producer for transactionGroup, then calls CommitPendingOffsets() on all IEntityTypeProducer registered in the group.

public void CommitTransactions(string transactionGroup)

Parameters

transactionGroup string

CreateTopicForEntity(IKEFCoreDatabase, IEntityType)

Creates a topic for IEntityType on Apache Kafka cluster

public virtual string CreateTopicForEntity(IKEFCoreDatabase database, IEntityType entityType)

Parameters

database IKEFCoreDatabase
entityType IEntityType

Returns

string

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

EnsureConnected(IKEFCoreDatabase, IDiagnosticsLogger<Update>)

public virtual bool EnsureConnected(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)

Parameters

database IKEFCoreDatabase
updateLogger IDiagnosticsLogger<DbLoggerCategory.Update>

Returns

bool

EnsureCreated(IKEFCoreDatabase, IDiagnosticsLogger<Update>)

public virtual bool EnsureCreated(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)

Parameters

database IKEFCoreDatabase
updateLogger IDiagnosticsLogger<DbLoggerCategory.Update>

Returns

bool

EnsureDeleted(IKEFCoreDatabase, IDiagnosticsLogger<Update>)

public virtual bool EnsureDeleted(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)

Parameters

database IKEFCoreDatabase
updateLogger IDiagnosticsLogger<DbLoggerCategory.Update>

Returns

bool

EnsureSynchronized(IKEFCoreDatabase, long)

Verify if local instance is synchronized with the IKEFCoreCluster instance

public virtual bool? EnsureSynchronized(IKEFCoreDatabase database, long timeout)

Parameters

database IKEFCoreDatabase
timeout long

Returns

bool?

ExecuteTransaction(IKEFCoreDatabase, IList<IUpdateEntry>, IDiagnosticsLogger<Update>)

Executes a transaction

public virtual int ExecuteTransaction(IKEFCoreDatabase database, IList<IUpdateEntry> entries, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)

Parameters

database IKEFCoreDatabase
entries IList<IUpdateEntry>
updateLogger IDiagnosticsLogger<DbLoggerCategory.Update>

Returns

int

ExecuteTransactionAsync(IKEFCoreDatabase, IList<IUpdateEntry>, IDiagnosticsLogger<Update>, CancellationToken)

Executes a transaction in async

public Task<int> ExecuteTransactionAsync(IKEFCoreDatabase database, IList<IUpdateEntry> entries, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger, CancellationToken cancellationToken = default)

Parameters

database IKEFCoreDatabase
entries IList<IUpdateEntry>
updateLogger IDiagnosticsLogger<DbLoggerCategory.Update>
cancellationToken CancellationToken

Returns

Task<int>

GetOrCreateTransactionalProducer(string, ITransactionalEntityTypeProducer)

Returns or creates the transactional KafkaProducer<K, V> for the given transactionGroup, calling InitTransactions() on first creation. Registers entityTypeProducer in the group in the same call.

public IProducer GetOrCreateTransactionalProducer(string transactionGroup, ITransactionalEntityTypeProducer entityTypeProducer)

Parameters

transactionGroup string

The transaction group name.

entityTypeProducer ITransactionalEntityTypeProducer

The ITransactionalEntityTypeProducer joining the group.

Returns

IProducer

The shared transactional producer for the group.

GetStreamsManager(IKEFCoreDatabase, Func<IKEFCoreDatabase, IStreamsManager>)

Retrieves the IStreamsManager associated to IKEFCoreDatabase in the instance of IKEFCoreCluster

public IStreamsManager GetStreamsManager(IKEFCoreDatabase database, Func<IKEFCoreDatabase, IStreamsManager> createFunc)

Parameters

database IKEFCoreDatabase
createFunc Func<IKEFCoreDatabase, IStreamsManager>

Returns

IStreamsManager

GetTable(IEntityType)

Retrieves the IKEFCoreTable associated to IEntityType in the instance of IKEFCoreCluster

public IKEFCoreTable GetTable(IEntityType entityType)

Parameters

entityType IEntityType

Returns

IKEFCoreTable

GetValueBuffer(IKEFCoreDatabase, IEntityType, object[])

Retrieve the ValueBuffer for a specified key

public ValueBuffer? GetValueBuffer(IKEFCoreDatabase database, IEntityType entityType, object[] keyValues)

Parameters

database IKEFCoreDatabase
entityType IEntityType
keyValues object[]

Returns

ValueBuffer?

GetValueBuffers(IKEFCoreDatabase, IEntityType)

Retrieve the ValueBuffer

public virtual IEnumerable<ValueBuffer> GetValueBuffers(IKEFCoreDatabase database, IEntityType entityType)

Parameters

database IKEFCoreDatabase
entityType IEntityType

Returns

IEnumerable<ValueBuffer>

GetValueBuffersByPrefix(IKEFCoreDatabase, IEntityType, object[])

Retrieve the ValueBuffer using prefix scan

public IEnumerable<ValueBuffer> GetValueBuffersByPrefix(IKEFCoreDatabase database, IEntityType entityType, object[] prefixValues)

Parameters

database IKEFCoreDatabase
entityType IEntityType
prefixValues object[]

Returns

IEnumerable<ValueBuffer>

GetValueBuffersRange(IKEFCoreDatabase, IEntityType, object[], object[])

Retrieve the ValueBuffer in a range of keys

public IEnumerable<ValueBuffer> GetValueBuffersRange(IKEFCoreDatabase database, IEntityType entityType, object[] rangeStart, object[] rangeEnd)

Parameters

database IKEFCoreDatabase
entityType IEntityType
rangeStart object[]
rangeEnd object[]

Returns

IEnumerable<ValueBuffer>

GetValueBuffersReverse(IKEFCoreDatabase, IEntityType)

Retrieve the ValueBuffer in reverse order

public IEnumerable<ValueBuffer> GetValueBuffersReverse(IKEFCoreDatabase database, IEntityType entityType)

Parameters

database IKEFCoreDatabase
entityType IEntityType

Returns

IEnumerable<ValueBuffer>

GetValueBuffersReverseRange(IKEFCoreDatabase, IEntityType, object[], object[])

Retrieve the ValueBuffer in a range of keys

public IEnumerable<ValueBuffer> GetValueBuffersReverseRange(IKEFCoreDatabase database, IEntityType entityType, object[] rangeStart, object[] rangeEnd)

Parameters

database IKEFCoreDatabase
entityType IEntityType
rangeStart object[]
rangeEnd object[]

Returns

IEnumerable<ValueBuffer>

LatestOffsetForEntity(IEntityType)

Returns the latest offset for each partition associated to entityType

public IDictionary<int, long> LatestOffsetForEntity(IEntityType entityType)

Parameters

entityType IEntityType

The IEntityType to check

Returns

IDictionary<int, long>

A IDictionary<TKey, TValue> containing the values

Register(IKEFCoreDatabase)

Register an instance of IKEFCoreDatabase in an instance of IKEFCoreCluster

public virtual void Register(IKEFCoreDatabase db)

Parameters

db IKEFCoreDatabase

ResetStreams(IKEFCoreDatabase)

Resets the Apache Kafka streams application associated to this IKEFCoreCluster instance

public void ResetStreams(IKEFCoreDatabase database)

Parameters

database IKEFCoreDatabase

Unregister(IKEFCoreDatabase)

Unregister a previously registered instance of IKEFCoreDatabase from an instance of IKEFCoreCluster

public virtual void Unregister(IKEFCoreDatabase database)

Parameters

database IKEFCoreDatabase

The instance of IKEFCoreDatabase to be unregistered