Class AppendManyResult

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

Represents the result of an append many operation.

public record AppendManyResult : IAppendResult, IAppendResultForObserverCompletion, IEquatable<AppendManyResult>
Inheritance
AppendManyResult
Implements
Inherited Members
Extension Methods

Constructors

AppendManyResult()

public AppendManyResult()

AppendManyResult(AppendManyResult)

protected AppendManyResult(AppendManyResult original)

Parameters

original AppendManyResult

Properties

AllAlreadyAppended

Gets a value indicating whether every event was already in the sequence, so this call wrote nothing.

public bool AllAlreadyAppended { get; }

Property Value

bool

ConcurrencyCheckPerformed

Gets a value indicating whether the concurrency check was actually performed for the operation.

public bool ConcurrencyCheckPerformed { get; init; }

Property Value

bool

Remarks

A skipped concurrency check looks from the outside exactly like a passing one - the append succeeds either way - so this is the only way for a caller to tell whether the serialization it believes it has was enforced. False means nothing was compared against the event store: the operation either asked for no check (None), carried no scope at all, or declared a scope with no expectation the kernel could validate (IsIncomplete). The first append into a scope reports false unless the first-append check is opted into - see CheckFirstAppendIntoAScope.

ConcurrencyViolations

Gets any concurrency violations that occurred during the operation.

public IEnumerable<ConcurrencyViolation> ConcurrencyViolations { get; init; }

Property Value

IEnumerable<ConcurrencyViolation>

ConstraintViolations

Gets any violations that occurred during the operation.

public IEnumerable<ConstraintViolation> ConstraintViolations { get; init; }

Property Value

IEnumerable<ConstraintViolation>

CorrelationId

Gets the CorrelationId for the operation.

public CorrelationId CorrelationId { get; init; }

Property Value

CorrelationId

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Errors

Gets any exception messages that might have occurred.

public IEnumerable<AppendError> Errors { get; init; }

Property Value

IEnumerable<AppendError>

EventSequenceId

Gets the event sequence that the append operation targeted.

public EventSequenceId EventSequenceId { get; }

Property Value

EventSequenceId

EventStore

Gets the event store where the append operation happened.

public EventStoreName EventStore { get; }

Property Value

EventStoreName

EventStoreNamespace

Gets the event store namespace where the append operation happened.

public EventStoreNamespaceName EventStoreNamespace { get; }

Property Value

EventStoreNamespaceName

EventTypes

Gets the event types appended by this operation. Empty retains the legacy wait-for-all behavior.

public IEnumerable<EventType> EventTypes { get; init; }

Property Value

IEnumerable<EventType>

HasConcurrencyViolations

Gets whether or not there are any concurrency violations that occurred.

public bool HasConcurrencyViolations { get; }

Property Value

bool

HasConstraintViolations

Gets whether or not there are any violations that occurred.

public bool HasConstraintViolations { get; }

Property Value

bool

HasErrors

Gets whether or not there are any errors that occurred.

public bool HasErrors { get; }

Property Value

bool

HasIdempotencyConflicts

Gets a value indicating whether any idempotency key was refused.

public bool HasIdempotencyConflicts { get; }

Property Value

bool

IdempotencyConflicts

Gets the idempotency keys that were refused because they already identify a different event.

public IEnumerable<IdempotencyKeyConflict> IdempotencyConflicts { get; init; }

Property Value

IEnumerable<IdempotencyKeyConflict>

IsSuccess

Gets a value indicating whether the operation was successful.

public bool IsSuccess { get; }

Property Value

bool

Outcomes

Gets what the append did for each event, aligned with SequenceNumbers. Every entry is Appended for an unkeyed append.

public IEnumerable<AppendOutcome> Outcomes { get; init; }

Property Value

IEnumerable<AppendOutcome>

SequenceNumbers

Gets the sequence numbers of the events that were appended, if successful. In the same sequence as the events were provided.

public IEnumerable<EventSequenceNumber> SequenceNumbers { get; init; }

Property Value

IEnumerable<EventSequenceNumber>

TailSequenceNumber

Gets the last event sequence number represented by the append operation.

public EventSequenceNumber TailSequenceNumber { get; }

Property Value

EventSequenceNumber

Methods

Equals(AppendManyResult?)

public virtual bool Equals(AppendManyResult? other)

Parameters

other AppendManyResult

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Failed(CorrelationId, IEnumerable<AppendError>)

Create a failed result with errors.

public static AppendManyResult Failed(CorrelationId correlationId, IEnumerable<AppendError> errors)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

errors IEnumerable<AppendError>

The errors.

Returns

AppendManyResult

A new failed AppendManyResult instance.

Failed(CorrelationId, IEnumerable<ConcurrencyViolation>)

Create a failed result with concurrency violations.

public static AppendManyResult Failed(CorrelationId correlationId, IEnumerable<ConcurrencyViolation> violations)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

violations IEnumerable<ConcurrencyViolation>

The ConcurrencyViolation instances that occurred.

Returns

AppendManyResult

A new failed AppendManyResult instance.

Failed(CorrelationId, IEnumerable<ConstraintViolation>)

Create a failed result with constraint violations.

public static AppendManyResult Failed(CorrelationId correlationId, IEnumerable<ConstraintViolation> violations)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

violations IEnumerable<ConstraintViolation>

The violations.

Returns

AppendManyResult

A new failed AppendManyResult instance.

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Success(CorrelationId, IEnumerable<EventSequenceNumber>)

Create a successful result.

public static AppendManyResult Success(CorrelationId correlationId, IEnumerable<EventSequenceNumber> sequenceNumbers)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

sequenceNumbers IEnumerable<EventSequenceNumber>

Collection of EventSequenceNumber to report.

Returns

AppendManyResult

A new AppendResult instance.

ToString()

public override string ToString()

Returns

string

Operators

operator ==(AppendManyResult?, AppendManyResult?)

public static bool operator ==(AppendManyResult? left, AppendManyResult? right)

Parameters

left AppendManyResult
right AppendManyResult

Returns

bool

operator !=(AppendManyResult?, AppendManyResult?)

public static bool operator !=(AppendManyResult? left, AppendManyResult? right)

Parameters

left AppendManyResult
right AppendManyResult

Returns

bool