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
originalAppendResult
Properties
ConcurrencyCheckPerformed
Gets a value indicating whether the concurrency check was actually performed for the operation.
public bool ConcurrencyCheckPerformed { get; init; }
Property Value
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
ConstraintViolations
Gets any violations that occurred during the operation.
public IEnumerable<ConstraintViolation> ConstraintViolations { get; init; }
Property Value
CorrelationId
Gets the CorrelationId for the operation.
public CorrelationId CorrelationId { get; init; }
Property Value
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
Errors
Gets any exception messages that might have occurred.
public IEnumerable<AppendError> Errors { get; init; }
Property Value
EventSequenceId
Gets the event sequence that the append operation targeted.
public EventSequenceId EventSequenceId { get; }
Property Value
EventStore
Gets the event store where the append operation happened.
public EventStoreName EventStore { get; }
Property Value
EventStoreNamespace
Gets the event store namespace where the append operation happened.
public EventStoreNamespaceName EventStoreNamespace { get; }
Property Value
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
HasConcurrencyViolations
Gets whether or not there are any concurrency violations that occurred.
public bool HasConcurrencyViolations { get; }
Property Value
HasConstraintViolations
Gets whether or not there are any violations that occurred.
public bool HasConstraintViolations { get; }
Property Value
HasErrors
Gets whether or not there are any errors that occurred.
public bool HasErrors { get; }
Property Value
HasIdempotencyConflicts
Gets a value indicating whether any idempotency key was refused.
public bool HasIdempotencyConflicts { get; }
Property Value
IdempotencyConflicts
Gets the idempotency keys that were refused because they already identify a different event.
public IEnumerable<IdempotencyKeyConflict> IdempotencyConflicts { get; init; }
Property Value
IsSuccess
Gets a value indicating whether the operation was successful.
public bool IsSuccess { get; }
Property Value
Outcome
Gets what an idempotent append did. Always Appended for an unkeyed append.
public AppendOutcome Outcome { get; init; }
Property Value
SequenceNumber
Gets the sequence number of the event that was appended, if successful.
public EventSequenceNumber SequenceNumber { get; init; }
Property Value
TailSequenceNumber
Gets the last event sequence number represented by the append operation.
public EventSequenceNumber TailSequenceNumber { get; }
Property Value
WasAlreadyAppended
Gets a value indicating whether the event was already in the sequence, so this call wrote nothing.
public bool WasAlreadyAppended { get; }
Property Value
Methods
Equals(AppendResult?)
public virtual bool Equals(AppendResult? other)
Parameters
otherAppendResult
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Failed(CorrelationId, ConcurrencyViolation)
Create a failed result with a concurrency violation.
public static AppendResult Failed(CorrelationId correlationId, ConcurrencyViolation violation)
Parameters
correlationIdCorrelationIdCorrelationId for the operation.
violationConcurrencyViolationThe 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
correlationIdCorrelationIdCorrelationId for the operation.
errorsIEnumerable<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
correlationIdCorrelationIdCorrelationId for the operation.
violationsIEnumerable<ConstraintViolation>The violations.
Returns
- AppendResult
A new failed AppendResult instance.
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Success(CorrelationId, EventSequenceNumber)
Create a successful result.
public static AppendResult Success(CorrelationId correlationId, EventSequenceNumber sequenceNumber)
Parameters
correlationIdCorrelationIdCorrelationId for the operation.
sequenceNumberEventSequenceNumberEventSequenceNumber to report.
Returns
- AppendResult
A new successful AppendResult instance.
ToString()
public override string ToString()
Returns
Operators
operator ==(AppendResult?, AppendResult?)
public static bool operator ==(AppendResult? left, AppendResult? right)
Parameters
leftAppendResultrightAppendResult
Returns
operator !=(AppendResult?, AppendResult?)
public static bool operator !=(AppendResult? left, AppendResult? right)
Parameters
leftAppendResultrightAppendResult