Table of Contents

Struct ErasureClaimResult

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

The result of asking a store for custody of an erasure request: an outcome, and — only when the request was granted — the identity the caller must present on every attestation write for that run.

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

Remarks

Why this is a type rather than a nullable identity. A string? can say "you hold it" and "you do not", and cannot say WHY not. The three refusals have different futures — a request another process holds returns by itself when that claim lapses, a request in an unexpected status does not, and a request that does not exist never will — so collapsing them forces every caller to re-read the row to decide what to do next, which is a second linearization point exactly where the first one was bought.

The identity is OPAQUE. It answers one question, by equality: is this write coming from the claim currently held? It carries no order, no issue sequence and no issuer, and comparing two of them for anything but equality is a defect. It is not a fencing token: a fencing token orders successive tenures against a resource shared by many rows, and the resource here is one request row and the attestation carried on it, where the store itself decides which of two contenders wins because the claim is a single conditional update.

It never leaves the executing method. Nothing puts it on a status, a result DTO or the wire. A caller that cannot obtain one cannot present one, which is what makes the opacity above a property of the design rather than a rule somebody has to remember.

A record struct rather than a plain one, and not for brevity. A value type here must implement equality -- the analyzers require it of every public struct -- so the choice is between a synthesised equality surface and a hand-written one, never between having it and not. The synthesised one is correct by construction. It does mean equality is publicly available on a type whose identity field must never be compared for ORDER; that is a different operation and the remarks above are where it is forbidden.

Properties

ClaimIdentity

Gets the identity this caller must present on every attestation write for this run.

public string? ClaimIdentity { get; }

Property Value

string

The granted identity, and null on every other outcome. Non-null if and only if Outcome is Granted.

Outcome

Gets what the store decided.

public ErasureClaimOutcome Outcome { get; }

Property Value

ErasureClaimOutcome

The outcome. NotDetermined on a default value, which no store returns and no caller may act on.

Methods

AlreadyClaimed()

Another process holds a claim that has not lapsed.

public static ErasureClaimResult AlreadyClaimed()

Returns

ErasureClaimResult

A refusal carrying no identity.

Granted(string)

The caller now holds the request.

public static ErasureClaimResult Granted(string claimIdentity)

Parameters

claimIdentity string

The minted identity. Must be non-empty.

Returns

ErasureClaimResult

A granted result carrying claimIdentity.

Remarks

The argument is checked rather than trusted because a granted result with no identity is the one shape a caller cannot act on and cannot detect: it would present null on its first fenced write, which is the predicate asserting that NOBODY holds the request.

Exceptions

ArgumentException

claimIdentity is null, empty or whitespace.

NotFound()

No such request exists in the ambient tenant.

public static ErasureClaimResult NotFound()

Returns

ErasureClaimResult

A refusal carrying no identity.

StatusMismatch()

The request is not in the status the caller expected.

public static ErasureClaimResult StatusMismatch()

Returns

ErasureClaimResult

A refusal carrying no identity.