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
optionsKEFCoreOptionsExtensioninfrastructureLoggerIDiagnosticsLogger<DbLoggerCategory.Infrastructure>tableFactoryIKEFCoreTableFactoryvalueGeneratorSelectorIValueGeneratorSelectorcomplexTypeConverterFactoryIComplexTypeConverterFactory
Remarks
Default initializer
Properties
ClusterId
The Apche Kafka cluster identifier
public virtual string ClusterId { get; }
Property Value
ComplexTypeConverterFactory
The global IComplexTypeConverterFactory
public virtual IComplexTypeConverterFactory ComplexTypeConverterFactory { get; }
Property Value
InfrastructureLogger
Reference to IDiagnosticsLogger<TLoggerCategory> received
public virtual IDiagnosticsLogger<DbLoggerCategory.Infrastructure> InfrastructureLogger { get; }
Property Value
ValueGeneratorSelector
The global IValueGeneratorSelector
public virtual IValueGeneratorSelector ValueGeneratorSelector { get; }
Property Value
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
transactionGroupstring
BeginTransactions(string)
Calls BeginTransaction() on the transactional producer for transactionGroup.
public void BeginTransactions(string transactionGroup)
Parameters
transactionGroupstring
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
transactionGroupstring
CreateTopicForEntity(IKEFCoreDatabase, IEntityType)
Creates a topic for IEntityType on Apache Kafka cluster
public virtual string CreateTopicForEntity(IKEFCoreDatabase database, IEntityType entityType)
Parameters
databaseIKEFCoreDatabaseentityTypeIEntityType
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public virtual void Dispose()
EnsureConnected(IKEFCoreDatabase, IDiagnosticsLogger<Update>)
Execute the EnsureDatabaseConnected()
public virtual bool EnsureConnected(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)
Parameters
databaseIKEFCoreDatabaseupdateLoggerIDiagnosticsLogger<DbLoggerCategory.Update>
Returns
EnsureCreated(IKEFCoreDatabase, IDiagnosticsLogger<Update>)
Execute the EnsureDatabaseCreated()
public virtual bool EnsureCreated(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)
Parameters
databaseIKEFCoreDatabaseupdateLoggerIDiagnosticsLogger<DbLoggerCategory.Update>
Returns
EnsureDeleted(IKEFCoreDatabase, IDiagnosticsLogger<Update>)
Execute the EnsureDatabaseDeleted()
public virtual bool EnsureDeleted(IKEFCoreDatabase database, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger)
Parameters
databaseIKEFCoreDatabaseupdateLoggerIDiagnosticsLogger<DbLoggerCategory.Update>
Returns
EnsureSynchronized(IKEFCoreDatabase, long)
Verify if local instance is synchronized with the IKEFCoreCluster instance
public virtual bool? EnsureSynchronized(IKEFCoreDatabase database, long timeout)
Parameters
databaseIKEFCoreDatabasetimeoutlong
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
databaseIKEFCoreDatabaseentriesIList<IUpdateEntry>updateLoggerIDiagnosticsLogger<DbLoggerCategory.Update>
Returns
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
databaseIKEFCoreDatabaseentriesIList<IUpdateEntry>updateLoggerIDiagnosticsLogger<DbLoggerCategory.Update>cancellationTokenCancellationToken
Returns
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
transactionGroupstringThe transaction group name.
entityTypeProducerITransactionalEntityTypeProducerThe 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
databaseIKEFCoreDatabasecreateFuncFunc<IKEFCoreDatabase, IStreamsManager>
Returns
GetTable(IEntityType)
Retrieves the IKEFCoreTable associated to IEntityType in the instance of IKEFCoreCluster
public IKEFCoreTable GetTable(IEntityType entityType)
Parameters
entityTypeIEntityType
Returns
GetValueBuffer(IKEFCoreDatabase, IEntityType, object[])
Retrieve the ValueBuffer for a specified key
public ValueBuffer? GetValueBuffer(IKEFCoreDatabase database, IEntityType entityType, object[] keyValues)
Parameters
databaseIKEFCoreDatabaseentityTypeIEntityTypekeyValuesobject[]
Returns
GetValueBuffers(IKEFCoreDatabase, IEntityType)
Retrieve the ValueBuffer
public virtual IEnumerable<ValueBuffer> GetValueBuffers(IKEFCoreDatabase database, IEntityType entityType)
Parameters
databaseIKEFCoreDatabaseentityTypeIEntityType
Returns
GetValueBuffersByPrefix(IKEFCoreDatabase, IEntityType, object[])
Retrieve the ValueBuffer using prefix scan
public IEnumerable<ValueBuffer> GetValueBuffersByPrefix(IKEFCoreDatabase database, IEntityType entityType, object[] prefixValues)
Parameters
databaseIKEFCoreDatabaseentityTypeIEntityTypeprefixValuesobject[]
Returns
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
databaseIKEFCoreDatabaseentityTypeIEntityTyperangeStartobject[]rangeEndobject[]
Returns
GetValueBuffersReverse(IKEFCoreDatabase, IEntityType)
Retrieve the ValueBuffer in reverse order
public IEnumerable<ValueBuffer> GetValueBuffersReverse(IKEFCoreDatabase database, IEntityType entityType)
Parameters
databaseIKEFCoreDatabaseentityTypeIEntityType
Returns
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
databaseIKEFCoreDatabaseentityTypeIEntityTyperangeStartobject[]rangeEndobject[]
Returns
LatestOffsetForEntity(IEntityType)
Returns the latest offset for each partition associated to entityType
public IDictionary<int, long> LatestOffsetForEntity(IEntityType entityType)
Parameters
entityTypeIEntityTypeThe 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
ResetStreams(IKEFCoreDatabase)
Resets the Apache Kafka streams application associated to this IKEFCoreCluster instance
public void ResetStreams(IKEFCoreDatabase database)
Parameters
databaseIKEFCoreDatabase
Unregister(IKEFCoreDatabase)
Unregister a previously registered instance of IKEFCoreDatabase from an instance of IKEFCoreCluster
public virtual void Unregister(IKEFCoreDatabase database)
Parameters
databaseIKEFCoreDatabaseThe instance of IKEFCoreDatabase to be unregistered