Class QdrantEventStore
Namespace: Cephalon.EventSourcing.Qdrant
Assembly: Cephalon.EventSourcing.Qdrant.dll
Qdrant-backed implementation of {streamId}:{streamVersion} for uniqueness.
Optimistic concurrency is enforced at the application layer via a pre-append version check.
public sealed class QdrantEventStore : IEventStore, IDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEventStore, IDisposable
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Section titled “Remarks”
Known limitation: The version-read followed by upsert is not fully atomic.
Two concurrent writers that both observe the same expectedVersion will both proceed
to issue their upsert statements. The compound point-ID hash provides a structural safeguard,
but optimistic concurrency is primarily enforced at the application layer, consistent with
the ClickHouse and OpenSearch provider approaches.
Constructors
Section titled “Constructors”QdrantEventStore(QdrantClient, string)
Section titled “ QdrantEventStore(QdrantClient, string)”Initializes a new instance of the
public QdrantEventStore(QdrantClient client, string collectionName)Parameters
Section titled “Parameters”client QdrantClient
The Qdrant client used to manage collections and points.
collectionName string
The Qdrant collection name used to persist event stream points.
Methods
Section titled “Methods”AppendAsync(string, IReadOnlyCollection<IDomainEvent>, long, CancellationToken)
Section titled “ AppendAsync(string, IReadOnlyCollection<IDomainEvent>, long, CancellationToken)”Appends one or more events to the requested stream after checking the expected version.
public Task AppendAsync(string streamId, IReadOnlyCollection<IDomainEvent> events, long expectedVersion, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
events IReadOnlyCollection<IDomainEvent>
The events to append.
expectedVersion long
The current stream version expected by the caller. Use -1 to require a brand-new stream.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”A task that completes when the append finishes.
Dispose()
Section titled “ Dispose()”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()GetVersionAsync(string, CancellationToken)
Section titled “ GetVersionAsync(string, CancellationToken)”Gets the latest version known for the requested stream.
public Task<long> GetVersionAsync(string streamId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”A task that returns the current stream version, or -1 when the stream does not exist.
ReadStreamAsync(string, long, CancellationToken)
Section titled “ ReadStreamAsync(string, long, CancellationToken)”Reads the requested stream from the supplied version onward.
public IAsyncEnumerable<IDomainEvent> ReadStreamAsync(string streamId, long fromVersion = 0, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
fromVersion long
The first stream version to include. The default is 0.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”IAsyncEnumerable<IDomainEvent>
An async sequence of domain events in ascending stream-version order.