Class DecisionReads

Namespace
Cratis.Chronicle.ReadModels
Assembly
Cratis.Chronicle.dll

Client-side implementation of decision-consistent reads.

public sealed class DecisionReads : IDecisionReads
Inheritance
DecisionReads
Implements
Inherited Members
Extension Methods

Methods

AdmitForStream<T>()

Checks whether the projection shape can be read within one event stream without I/O.

public DecisionReadAdmission AdmitForStream<T>() where T : class

Returns

DecisionReadAdmission

The admission result.

Type Parameters

T

The read model type.

Exceptions

DecisionReadRefused

The reader does not support stream-scoped reads.

Admit<T>()

Checks the projection shape without I/O.

public DecisionReadAdmission Admit<T>() where T : class

Returns

DecisionReadAdmission

The admission result.

Type Parameters

T

The read model type.

Describe<T>()

Describes local shape admission, guarded types and generation delivery without I/O.

public DecisionReadDescription Describe<T>() where T : class

Returns

DecisionReadDescription

The local description.

Type Parameters

T

The read model type.

Exceptions

DecisionReadRefused

The reader does not support local descriptions.

GetDetached<T>(EventSourceId, EventStreamType, EventStreamId, EventSourceType?, CancellationToken)

Reads one event stream without enrolling; pass the result to a unit of work or guarded append.

public Task<DecisionRead<T>> GetDetached<T>(EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, EventSourceType? eventSourceType = null, CancellationToken cancellationToken = default) where T : class

Parameters

eventSourceId EventSourceId

The event source identifier.

eventStreamType EventStreamType

The event stream type.

eventStreamId EventStreamId

The event stream identifier.

eventSourceType EventSourceType

The optional event source type filter.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The guarded read.

Type Parameters

T

The read model type.

Exceptions

DecisionReadRefused

The reader does not support stream-scoped reads.

GetDetached<T>(ReadModelKey, CancellationToken)

Reads without enrolling; pass the result to a unit of work or guarded append.

public Task<DecisionRead<T>> GetDetached<T>(ReadModelKey key, CancellationToken cancellationToken = default) where T : class

Parameters

key ReadModelKey

The raw source key.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The guarded read.

Type Parameters

T

The read model type.

GetFor<T>(IUnitOfWork, EventSourceId, EventStreamType, EventStreamId, EventSourceType?, CancellationToken)

Acquires and enrolls one event stream into the given unit before returning.

public Task<DecisionRead<T>> GetFor<T>(IUnitOfWork unitOfWork, EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, EventSourceType? eventSourceType = null, CancellationToken cancellationToken = default) where T : class

Parameters

unitOfWork IUnitOfWork

The receiving unit, which must own the active frame.

eventSourceId EventSourceId

The event source identifier.

eventStreamType EventStreamType

The event stream type.

eventStreamId EventStreamId

The event stream identifier.

eventSourceType EventSourceType

The optional event source type.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The enrolled read.

Type Parameters

T

The read model type.

Exceptions

UnitOfWorkReadProtectionNotSupported

The reader does not support explicit unit acquisition.

GetFor<T>(IUnitOfWork, ReadModelKey, CancellationToken)

Acquires and enrolls a fresh read into the given unit before returning.

public Task<DecisionRead<T>> GetFor<T>(IUnitOfWork unitOfWork, ReadModelKey key, CancellationToken cancellationToken = default) where T : class

Parameters

unitOfWork IUnitOfWork

The receiving unit, which must own the active frame.

key ReadModelKey

The raw source key.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The enrolled read.

Type Parameters

T

The read model type.

Exceptions

UnitOfWorkReadProtectionNotSupported

The reader does not support explicit unit acquisition.

Get<T>(EventSourceId, EventStreamType, EventStreamId, EventSourceType?, CancellationToken)

Reads one event stream and enrolls the read into the ambient unit of work.

public Task<DecisionRead<T>> Get<T>(EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, EventSourceType? eventSourceType = null, CancellationToken cancellationToken = default) where T : class

Parameters

eventSourceId EventSourceId

The event source identifier.

eventStreamType EventStreamType

The event stream type.

eventStreamId EventStreamId

The event stream identifier.

eventSourceType EventSourceType

The optional event source type filter.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The guarded read.

Type Parameters

T

The read model type.

Exceptions

DecisionReadRefused

The reader does not support stream-scoped reads.

Get<T>(ReadModelKey, CancellationToken)

Reads and enrolls into the ambient unit of work.

public Task<DecisionRead<T>> Get<T>(ReadModelKey key, CancellationToken cancellationToken = default) where T : class

Parameters

key ReadModelKey

The raw source key.

cancellationToken CancellationToken

Optional cancellation.

Returns

Task<DecisionRead<T>>

The guarded read.

Type Parameters

T

The read model type.