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
TThe 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
TThe 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
TThe 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
eventSourceIdEventSourceIdThe event source identifier.
eventStreamTypeEventStreamTypeThe event stream type.
eventStreamIdEventStreamIdThe event stream identifier.
eventSourceTypeEventSourceTypeThe optional event source type filter.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The guarded read.
Type Parameters
TThe 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
keyReadModelKeyThe raw source key.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The guarded read.
Type Parameters
TThe 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
unitOfWorkIUnitOfWorkThe receiving unit, which must own the active frame.
eventSourceIdEventSourceIdThe event source identifier.
eventStreamTypeEventStreamTypeThe event stream type.
eventStreamIdEventStreamIdThe event stream identifier.
eventSourceTypeEventSourceTypeThe optional event source type.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The enrolled read.
Type Parameters
TThe 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
unitOfWorkIUnitOfWorkThe receiving unit, which must own the active frame.
keyReadModelKeyThe raw source key.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The enrolled read.
Type Parameters
TThe 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
eventSourceIdEventSourceIdThe event source identifier.
eventStreamTypeEventStreamTypeThe event stream type.
eventStreamIdEventStreamIdThe event stream identifier.
eventSourceTypeEventSourceTypeThe optional event source type filter.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The guarded read.
Type Parameters
TThe 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
keyReadModelKeyThe raw source key.
cancellationTokenCancellationTokenOptional cancellation.
Returns
- Task<DecisionRead<T>>
The guarded read.
Type Parameters
TThe read model type.