Class EventsWithConcurrencyScopes

Namespace
Cratis.Chronicle.EventSequences
Assembly
Cratis.Chronicle.dll

Represents an ordered collection of events to append together with the concurrency scopes that must be checked by the same append operation.

public sealed class EventsWithConcurrencyScopes
Inheritance
EventsWithConcurrencyScopes
Inherited Members
Extension Methods

Remarks

Both inputs, including each scope's nested EventTypes, are materialized when this value is created. For a label that targets an event source in Events, a missing scope or NotSet retains the normal AppendMany(IEnumerable<EventForEventSourceId>, CorrelationId?, IEnumerable<string>?, IDictionary<EventSourceId, ConcurrencyScope>?) strategy resolution. An independent non-target label must use a concrete exact scope or None. A scope label does not need to match an event target unless the scope narrows by EventSourceId; when it does, the label and narrowed event source must match.

Constructors

EventsWithConcurrencyScopes(IEnumerable<EventForEventSourceId>, IEnumerable<KeyValuePair<EventSourceId, ConcurrencyScope>>)

Initializes a new instance of the EventsWithConcurrencyScopes class.

public EventsWithConcurrencyScopes(IEnumerable<EventForEventSourceId> events, IEnumerable<KeyValuePair<EventSourceId, ConcurrencyScope>> concurrencyScopes)

Parameters

events IEnumerable<EventForEventSourceId>

The events to append, in append order.

concurrencyScopes IEnumerable<KeyValuePair<EventSourceId, ConcurrencyScope>>

The independently labeled concurrency scopes to pass to the append operation.

Exceptions

ConcurrencyScopeLabelMustBeSpecified

Thrown when an event target or scope label is unspecified, blank, or whitespace.

DuplicateConcurrencyScopeForEventSourceId

Thrown when the same predicate has conflicting expectations or mixes no guard with a guard, or mixes strategy resolution with an explicit guard.

ConcurrencyScopeEventSourceIdDoesNotMatchLabel

Thrown when a scope narrows by an event source different from its label.

IndependentConcurrencyScopeMustBeExplicit

Thrown when an independent non-target label has a scope that cannot be validated explicitly.

Properties

ConcurrencyScopes

Gets the copied scopes when every label has at most one predicate.

public IReadOnlyDictionary<EventSourceId, ConcurrencyScope> ConcurrencyScopes { get; }

Property Value

IReadOnlyDictionary<EventSourceId, ConcurrencyScope>

Remarks

Use Entries for conjunctions. This accessor refuses rather than discarding guards.

Exceptions

DuplicateConcurrencyScopeForEventSourceId

A label has multiple scopes.

Entries

Gets the ordered scope entries, including several predicates for the same label.

public IReadOnlyList<KeyValuePair<EventSourceId, ConcurrencyScope>> Entries { get; }

Property Value

IReadOnlyList<KeyValuePair<EventSourceId, ConcurrencyScope>>

Events

Gets the materialized events in the order they will be submitted to the append operation.

public IReadOnlyList<EventForEventSourceId> Events { get; }

Property Value

IReadOnlyList<EventForEventSourceId>