Class AppendResult

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

Represents the result of an append operation.

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

Constructors

AppendResult()

public AppendResult()

AppendResult(AppendResult)

protected AppendResult(AppendResult original)

Parameters

original AppendResult

Properties

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.

ConcurrencyViolation

Gets any concurrency violation that occurred during the operation.

public ConcurrencyViolation? ConcurrencyViolation { get; init; }

Property Value

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

Outcome

Gets what an idempotent append did. Always Appended for an unkeyed append.

public AppendOutcome Outcome { get; init; }

Property Value

AppendOutcome

SequenceNumber

Gets the sequence number of the event that was appended, if successful.

public EventSequenceNumber SequenceNumber { get; init; }

Property Value

EventSequenceNumber

TailSequenceNumber

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

public EventSequenceNumber TailSequenceNumber { get; }

Property Value

EventSequenceNumber

WasAlreadyAppended

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

public bool WasAlreadyAppended { get; }

Property Value

bool

Methods

Equals(AppendResult?)

public virtual bool Equals(AppendResult? other)

Parameters

other AppendResult

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Failed(CorrelationId, ConcurrencyViolation)

Create a failed result with a concurrency violation.

public static AppendResult Failed(CorrelationId correlationId, ConcurrencyViolation violation)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

violation ConcurrencyViolation

The ConcurrencyViolation that occurred.

Returns

AppendResult

A new failed AppendResult instance.

Failed(CorrelationId, IEnumerable<AppendError>)

Create a failed result with errors.

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

Parameters

correlationId CorrelationId

CorrelationId for the operation.

errors IEnumerable<AppendError>

The errors.

Returns

AppendResult

A new failed AppendResult instance.

Failed(CorrelationId, IEnumerable<ConstraintViolation>)

Create a failed result with constraint violations.

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

Parameters

correlationId CorrelationId

CorrelationId for the operation.

violations IEnumerable<ConstraintViolation>

The violations.

Returns

AppendResult

A new failed AppendResult instance.

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Success(CorrelationId, EventSequenceNumber)

Create a successful result.

public static AppendResult Success(CorrelationId correlationId, EventSequenceNumber sequenceNumber)

Parameters

correlationId CorrelationId

CorrelationId for the operation.

sequenceNumber EventSequenceNumber

EventSequenceNumber to report.

Returns

AppendResult

A new successful AppendResult instance.

ToString()

public override string ToString()

Returns

string

Operators

operator ==(AppendResult?, AppendResult?)

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

Parameters

left AppendResult
right AppendResult

Returns

bool

operator !=(AppendResult?, AppendResult?)

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

Parameters

left AppendResult
right AppendResult

Returns

bool