Class ErasureContributorResult
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Result of an IErasureContributor erasure operation.
public sealed record ErasureContributorResult : IEquatable<ErasureContributorResult>
- Inheritance
-
ErasureContributorResult
- Implements
- Inherited Members
Properties
DischargedLocations
Gets the table-and-field pairs this contributor erased for the subject.
public IReadOnlyList<DataLocationKey> DischargedLocations { get; init; }
Property Value
Remarks
This is what discharges a registered obligation, and it is asserted per pair rather than per store kind. Declaring a store kind says what a contributor is ABLE to reach; this says what it actually erased for this subject, which is the only claim a certificate can rest on.
The default is empty, and that is deliberate: a contributor that reports success without naming what it erased discharges NOTHING, so any registered obligation remains outstanding and the erasure cannot be reported complete. Failing closed on silence is the point — the alternative is a contributor that runs, deletes no rows, and satisfies the gate for every table in its store.
ErrorMessage
Gets an error message if the operation failed.
public string? ErrorMessage { get; init; }
Property Value
RecordsAffected
Gets the number of records affected by this contributor.
public int RecordsAffected { get; init; }
Property Value
RetainedData
Gets the data this contributor deliberately did NOT erase, each entry carrying the basis it was retained under.
public IReadOnlyList<ErasureException> RetainedData { get; init; }
Property Value
Remarks
A contributor that withholds destruction must say so here. The entries are carried onto the erasure certificate alongside the framework's own exemptions, so a reader can tell an erasure that destroyed everything from one that lawfully kept a record. A certificate reporting a clean completion over data deliberately kept is the defect this exists to make impossible: silence is what makes a retention undetectable from outside.
This is a sibling of DischargedLocations and never a substitute for it. That names what was erased; this names what was kept and why.
It is carried on a FAILED result too, and that is the point rather than an oversight. What a contributor kept is a fact about the store; whether the same pass also failed somewhere else is a fact about the run. Dropping the retentions because an unrelated aggregate's read model was briefly unreachable would make the partial-erasure certificate — the one a controller reconciles by hand, and therefore the one that most needs the list — the only certificate that never names what survived.
Success
Gets whether the contributor's erasure succeeded.
public required bool Success { get; init; }
Property Value
Methods
Failed(string)
Creates a failed result.
public static ErasureContributorResult Failed(string errorMessage)
Parameters
errorMessagestringThe error message.
Returns
- ErasureContributorResult
A failed contributor result.
Failed(string, IReadOnlyList<ErasureException>)
Creates a failed result that still names the data the contributor lawfully kept.
public static ErasureContributorResult Failed(string errorMessage, IReadOnlyList<ErasureException> retainedData)
Parameters
errorMessagestringThe error message.
retainedDataIReadOnlyList<ErasureException>The data deliberately kept, each entry carrying its legal basis.
Returns
- ErasureContributorResult
A failed result carrying its retentions.
Remarks
Prefer this overload wherever a contributor can both retain and fail in one pass. A retention withheld from the record because something else went wrong is the silence this type exists to prevent, arriving by the ordinary route of one unreachable store.
Succeeded(int)
Creates a successful result that discharges NO registered obligation.
public static ErasureContributorResult Succeeded(int recordsAffected)
Parameters
recordsAffectedintThe number of records erased.
Returns
- ErasureContributorResult
A successful contributor result naming nothing it erased.
Remarks
Prefer the overload that names the erased table-and-field pairs. This one reports success without evidence, so every registered obligation stays outstanding and the erasure cannot be reported complete — which is the safe direction, but it means a contributor using this overload can never satisfy the coverage gate on its own.
Succeeded(int, IReadOnlyList<DataLocationKey>)
Creates a successful result that names the table-and-field pairs the contributor erased.
public static ErasureContributorResult Succeeded(int recordsAffected, IReadOnlyList<DataLocationKey> dischargedLocations)
Parameters
recordsAffectedintThe number of records erased.
dischargedLocationsIReadOnlyList<DataLocationKey>The pairs erased for this subject.
Returns
- ErasureContributorResult
A successful result carrying its discharged obligations.
Succeeded(int, IReadOnlyList<DataLocationKey>, IReadOnlyList<ErasureException>)
Creates a successful result that names both what the contributor erased and what it lawfully kept.
public static ErasureContributorResult Succeeded(int recordsAffected, IReadOnlyList<DataLocationKey> dischargedLocations, IReadOnlyList<ErasureException> retainedData)
Parameters
recordsAffectedintThe number of records erased.
dischargedLocationsIReadOnlyList<DataLocationKey>The pairs erased for this subject.
retainedDataIReadOnlyList<ErasureException>The data deliberately kept, each entry carrying its legal basis.
Returns
- ErasureContributorResult
A successful result carrying its discharged obligations and its retentions.