Interface IErasureQueryStore
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Query operations for erasure requests.
public interface IErasureQueryStore
Remarks
This sub-interface of IErasureStore isolates query/listing concerns per the Interface Segregation Principle (ISP).
Consumers that only need to query erasure requests can depend on this
interface directly. Implementations that also implement IErasureStore
expose this interface via GetService(typeof(IErasureQueryStore)).
Methods
GetScheduledRequestsAsync(int, CancellationToken)
Gets requests ready for execution: those past their grace period, AND those whose execution claim has lapsed.
Task<IReadOnlyList<ErasureStatus>> GetScheduledRequestsAsync(int maxResults, CancellationToken cancellationToken)
Parameters
maxResultsintMaximum number of results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<ErasureStatus>>
List of requests ready to execute.
Remarks
The second half of that is what makes an interrupted erasure come back. A request whose executor died stays in the claimed status with nothing to advance it, and this query is the only thing that offers work — so a predicate naming the scheduled status alone excludes it forever, correctly and silently. The subject's data is then never erased, nothing throws, nothing logs, and no operator has a row to look at.
A request is returned when its claim has LAPSED, never while a claim is live, so a caller may attempt it without first asking who holds it. The claim itself is still the authority: two callers handed the same lapsed request will both try, and exactly one is granted.
The lapse is decided against a clock the STORE reads, not one a caller supplies. A lapse decided against a caller's instant is a comparison between two machines' clocks, which is the one comparison that may never decide anything.
ListRequestsAsync(ErasureRequestStatus?, string?, DateTimeOffset?, DateTimeOffset?, int, int, CancellationToken)
Lists erasure requests matching criteria with pagination.
Task<IReadOnlyList<ErasureStatus>> ListRequestsAsync(ErasureRequestStatus? status, string? tenantId, DateTimeOffset? fromDate, DateTimeOffset? toDate, int pageNumber, int pageSize, CancellationToken cancellationToken)
Parameters
statusErasureRequestStatus?Optional status filter; null applies no status filter.
tenantIdstringThe owning tenant to narrow the result to, or null or empty to apply no tenant filter. A non-empty value is compared ordinally against each request's recorded owner.
fromDateDateTimeOffset?Optional inclusive lower bound on
RequestedAt.toDateDateTimeOffset?Optional inclusive upper bound on
RequestedAt.pageNumberintThe 1-based page number (minimum 1).
pageSizeintThe number of items per page (minimum 1, maximum 1000).
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<ErasureStatus>>
List of matching requests for the requested page.
Remarks
Effects. Returns one page of the requests visible to the ambient tenant scope, ordered by
RequestedAt descending, where the page window is taken over the filtered and ordered
set — never over an unfiltered page that is then filtered, which silently loses rows once the
matching set is larger than pageSize. Nothing is modified.
Which tenant fact tenantId means. It is matched against
TenantId — the owner the store itself resolved when the request was
saved — and never against TenantPartition. The two answer different
questions and an implementation that filters on the partition instead will appear to work on a
deployment where they coincide. The owner is the term the per-subject key handle is composed from,
so it is the one that decides which key an erasure destroys.
The comparison is ordinal. No case folding, no trimming, no prefix or pattern matching, and no canonicalisation of a missing owner onto a reserved sentinel. Two identifiers differing only in case are two tenants, and an implementation that folds them hands one tenant's erasure requests to another. Where the comparison is delegated to a database, the column holding the owner needs a binary or otherwise deterministic collation, or the engine folds the distinction beneath correct-looking code. A whitespace-only argument is a filter term rather than an absent one, and it matches nothing: a recorded owner is never empty or whitespace.
Invariant — a supplied filter can only narrow. The result for any
tenantId is a subset of the result for null, and no argument
can admit a request the ambient tenant scope excludes. A caller naming another tenant receives the
empty set rather than that tenant's requests; a caller naming none still receives only their own
ambient scope. Widening is not an expressible outcome of this parameter.
Under multi-tenancy with no ambient tenant resolved, implementations fail closed — they raise rather than reach an unfiltered read.
Exceptions
- ArgumentOutOfRangeException
pageNumberis less than 1, orpageSizeis less than 1 or greater than 1000.