Interface IErasureRetentionRegistry
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Answers whether an aggregate type is under a declared retention.
public interface IErasureRetentionRegistry
Remarks
Consulted by the erasure path before it destroys anything. Nothing declared means every aggregate is erased exactly as it was before this existed, so the behaviour of an application that declares no retention is unchanged.
Properties
Declared
Gets every declared retention, for reporting and for startup diagnostics.
IReadOnlyCollection<ErasureRetention> Declared { get; }
Property Value
- IReadOnlyCollection<ErasureRetention>
The declared retentions, in no particular order.
Remarks
At most one entry per (tenant, aggregate type). Every entry has a non-blank AggregateType, a defined Basis, a Justification that says more than the basis does, and a RetentionPeriod greater than zero — established once, at startup, so no consumer has to re-check it.
Methods
IsRetainedForAnyTenant(string?)
Answers whether ANY tenant has declared a retention for an aggregate type.
bool IsRetainedForAnyTenant(string? aggregateType)
Parameters
aggregateTypestringThe aggregate type name as the event store records it.
Returns
- bool
true when at least one declaration names this aggregate type, whatever tenant it belongs to; otherwise false.
Remarks
This is the WRITE path's question, and it is deliberately tenant-blind. A write decides only whether to place a subject's fields under a separately destroyable key for the aggregate type being written into. The tenant is no part of that key's name, so it is no part of that decision — which is why nothing on the write path reads a tenant, and why none can be inferred there.
Being blind here withholds erasure from nobody, because the two decisions are independent. Widening is per aggregate type; SPARING is per tenant and is decided later, through TryGetRetention(KeyedTenantPartition, string?, out ErasureRetention?). A subject belonging to a tenant that declared nothing therefore has their fields written under a widened handle and then destroyed, because no declaration matches their erasure. The only thing widening changes is WHICH key an erasure has to decide about — never whether it may decide.
Total: it throws nothing. A null, empty or whitespace type is not declared, so it answers false. This runs on the path that writes personal data, and an exception here would refuse a write the framework has no reason to refuse.
Consistent with Declared: it answers true for exactly the aggregate types named there.
TryGetRetention(KeyedTenantPartition, string?, out ErasureRetention?)
Attempts to find the retention declared for an aggregate type.
bool TryGetRetention(KeyedTenantPartition tenant, string? aggregateType, out ErasureRetention? retention)
Parameters
tenantKeyedTenantPartitionThe tenant this erasure belongs to, as the erasure request recorded it. Every spelling of untenanted is accepted and collapsed onto UntenantedSentinel, so a single-tenant deployment matches its own declarations whether its requests name no tenant, an empty one, or the sentinel itself.
aggregateTypestringThe aggregate type name as the event store records it.
retentionErasureRetentionThe declared retention when one exists; otherwise null.
Returns
Remarks
TOTAL IN THE AGGREGATE TYPE, NOT IN THE PARTITION. An unknown, empty or whitespace type answers false rather than throwing, because this runs on the path that decides whether to destroy a record and a throw would turn an unrecognised type into a failed erasure. An ABSENT partition is different in kind: it cannot arise from data, only from a caller that did not supply one, and answering false for it would mean "no retention applies", which on this path means DESTROY. So that case throws, loudly, rather than being absorbed into a verdict it cannot support.
Matching is ORDINAL, and the consequence of the alternative is data loss rather than a missed
lookup. A declaration of salesrecord against a store recording SalesRecord is not
a retention, and the record is destroyed. Declare the type exactly as the event store records it.
Consistent with Declared in both directions: every declared retention is findable by its own aggregate type, and every retention this returns is one of them.
Superseded, quoted so a reader who inherited it recognises it: "Total: it throws
nothing. A null, empty or whitespace type is not declared, so it answers
false." That was true when the partition was not a separate argument. It is no
longer: an absent partition throws, and the two statements sat in two remarks blocks on this
one member, contradicting each other, where the documentation generator keeps only one — so which
claim a consumer read was arbitrary.