Class DecisionReadExtensions
- Namespace
- Cratis.Chronicle.ReadModels
- Assembly
- Cratis.Chronicle.dll
Additive entry points for guarded appends and non-DI reads.
public static class DecisionReadExtensions
- Inheritance
-
DecisionReadExtensions
- Inherited Members
Methods
AppendMany(IEventSequence, IEnumerable<EventForEventSourceId>, IEnumerable<IDecisionRead>)
Validates the reads and appends the events atomically in the event-log grain.
public static Task<AppendManyResult> AppendMany(this IEventSequence sequence, IEnumerable<EventForEventSourceId> events, IEnumerable<IDecisionRead> guardedBy)
Parameters
sequenceIEventSequenceThe event-log sequence.
eventsIEnumerable<EventForEventSourceId>The events to append.
guardedByIEnumerable<IDecisionRead>The protected reads to validate.
Returns
- Task<AppendManyResult>
The append result.
Exceptions
- DecisionReadTargetMismatch
The sequence or a token targets a different log.
- UnprotectedDecisionRead
A read has no guard.
- ImmediateAppendRefused
Immediate appends are refused in the current flow.
- DecisionReadValidateOnlyNotSupported
The kernel rejected a validate-only append.
- ArgumentException
At least one guard is required.
GetDecisionConflicts(AppendManyResult, IEnumerable<IDecisionRead>)
Maps guarded append concurrency violations to decision conflicts.
public static IEnumerable<DecisionConflict> GetDecisionConflicts(this AppendManyResult result, IEnumerable<IDecisionRead> reads)
Parameters
resultAppendManyResultThe guarded append result.
readsIEnumerable<IDecisionRead>The reads that guarded the append.
Returns
- IEnumerable<DecisionConflict>
The read models and keys whose decisions conflicted, with the first conflicting event when the kernel reported it.
GetDecisionReads(IEventStore)
Gets a decision reader for this event store.
public static IDecisionReads GetDecisionReads(this IEventStore eventStore)
Parameters
eventStoreIEventStoreThe event store.
Returns
- IDecisionReads
A decision reader.