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

sequence IEventSequence

The event-log sequence.

events IEnumerable<EventForEventSourceId>

The events to append.

guardedBy IEnumerable<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

result AppendManyResult

The guarded append result.

reads IEnumerable<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

eventStore IEventStore

The event store.

Returns

IDecisionReads

A decision reader.