Table of Contents

Struct ProjectionRefoldResult

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

The outcome of a re-fold. A SEPARATE type from ProjectionAdvanceResult, deliberately.

public readonly record struct ProjectionRefoldResult : IEquatable<ProjectionRefoldResult>
Implements
Inherited Members

Remarks

Why this is not a ProjectionAdvanceResult, which carries the same values. Because the two are settled by opposite rules, and the mistake is invisible.

For an ADVANCE, Superseded with a position at or beyond the one attempted means another writer is ahead, the work is already done, and the caller should stop. For a RE-FOLD that is exactly backwards: the writer who is ahead folded from the PRE-CHANGE stream, so being ahead is precisely the condition under which the stale state has been reintroduced. A re-fold that stops there has silently undone an erasure and reported success.

That mistake has already shipped once, which is why the type exists rather than a comment: recovery passed a re-fold's outcome to the advance predicate, the predicate read it as settled, and a projection kept an erased subject's data while the service logged a successful recovery. Passing the wrong result type now fails to compile.

Note the tell: the re-fold rule needs no attempted position and the advance rule does. They are not one function parameterised — they are different functions, and the signatures say so.

Constructors

ProjectionRefoldResult(ProjectionRefoldOutcome, long?)

The outcome of a re-fold. A SEPARATE type from ProjectionAdvanceResult, deliberately.

public ProjectionRefoldResult(ProjectionRefoldOutcome Outcome, long? CurrentPosition)

Parameters

Outcome ProjectionRefoldOutcome

What the re-fold did.

CurrentPosition long?

The position the store holds now.

Remarks

Why this is not a ProjectionAdvanceResult, which carries the same values. Because the two are settled by opposite rules, and the mistake is invisible.

For an ADVANCE, Superseded with a position at or beyond the one attempted means another writer is ahead, the work is already done, and the caller should stop. For a RE-FOLD that is exactly backwards: the writer who is ahead folded from the PRE-CHANGE stream, so being ahead is precisely the condition under which the stale state has been reintroduced. A re-fold that stops there has silently undone an erasure and reported success.

That mistake has already shipped once, which is why the type exists rather than a comment: recovery passed a re-fold's outcome to the advance predicate, the predicate read it as settled, and a projection kept an erased subject's data while the service logged a successful recovery. Passing the wrong result type now fails to compile.

Note the tell: the re-fold rule needs no attempted position and the advance rule does. They are not one function parameterised — they are different functions, and the signatures say so.

Properties

CurrentPosition

The position the store holds now.

public long? CurrentPosition { get; init; }

Property Value

long?

Outcome

What the re-fold did.

public ProjectionRefoldOutcome Outcome { get; init; }

Property Value

ProjectionRefoldOutcome