Interface ILegalHoldQueryStore
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Query operations for legal holds.
public interface ILegalHoldQueryStore
Remarks
This sub-interface of ILegalHoldStore isolates query/listing concerns per the Interface Segregation Principle (ISP).
Consumers that only need to query legal holds can depend on this
interface directly. Implementations that also implement ILegalHoldStore
expose this interface via GetService(typeof(ILegalHoldQueryStore)).
IN FORCE IS THE CONJUNCTION OF TWO INDEPENDENT FACTS, and every member named for active holds means in force. IsActive answers whether the hold was RELEASED -- an act, with an actor, a time and a reason, recorded alongside it. ExpiresAt answers whether the stated period has LAPSED -- the passage of time, with no actor. Neither fact implies the other, and an implementation may not use one as a proxy for the other: a hold is in force when it is neither released NOR lapsed. A hold carrying no expiry has not lapsed and stays in force until it is released, which is the indefinite hold and the commonest kind.
A member's predicate follows from the question it asks, so this is not a rule that every statement carries an expiry term. The in-force members ask "not released AND not lapsed"; GetExpiredHoldsAsync(CancellationToken) asks the complementary question, "not released AND lapsed", and adding an expiry term to it uniformly would ask for holds that have both lapsed and not lapsed.
A lapsed hold must not be reported in force even when no expiration sweep is running. The sweep RELEASES lapsed holds and is registered separately from hold storage, so a deployment that stores holds without it is a supported composition. A correctness property may not depend on an optional background actor having run: reported in force forever, a lapsed hold refuses an erasure that should proceed and leaves the obligation permanently undischarged with nothing recording why.
In-force results are ordered by CreatedAt descending -- newest first -- so a caller reading the first row reads the most recent order. The hold carries the basis, case reference and description an operator acts on, so an arbitrary order is not a usable contract.
Methods
GetActiveHoldsForDataSubjectAsync(string, string?, DateTimeOffset, CancellationToken)
Gets all active holds for a data subject.
Task<IReadOnlyList<LegalHold>> GetActiveHoldsForDataSubjectAsync(string dataSubjectIdHash, string? tenantId, DateTimeOffset asOf, CancellationToken cancellationToken)
Parameters
dataSubjectIdHashstringThe hashed data subject identifier.
tenantIdstringOptional tenant ID. Narrows the result to that tenant's holds plus every global hold; it never widens the result to another tenant's holds.
asOfDateTimeOffsetThe instant the question is asked at. A hold is in force at
asOfwhen it was released at no point and has not lapsed by then. The caller supplies it so the answer is decidable and so several reads that must agree can be pinned to one instant.cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<LegalHold>>
List of active holds.
Remarks
A hold that belongs to no tenant is a global preservation order and is returned to every caller, including one who names a tenant. A legal hold blocks erasure, so a global order that a scoped read omits is one that has silently stopped blocking, and the deletion it should have prevented is irreversible. The tenant argument still excludes every OTHER tenant's holds.
GetActiveHoldsForTenantAsync(string, DateTimeOffset, CancellationToken)
Gets all active holds for a tenant (tenant-wide holds).
Task<IReadOnlyList<LegalHold>> GetActiveHoldsForTenantAsync(string tenantId, DateTimeOffset asOf, CancellationToken cancellationToken)
Parameters
tenantIdstringThe tenant ID.
asOfDateTimeOffsetThe instant the question is asked at. A hold is in force at
asOfwhen it was released at no point and has not lapsed by then. The caller supplies it so the answer is decidable and so several reads that must agree can be pinned to one instant.cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<LegalHold>>
List of active tenant-wide holds.
Remarks
A hold that belongs to no tenant is a global preservation order and is returned to every caller, including one who names a tenant. A legal hold blocks erasure, so a global order that a scoped read omits is one that has silently stopped blocking, and the deletion it should have prevented is irreversible. The tenant argument still excludes every OTHER tenant's holds.
GetExpiredHoldsAsync(CancellationToken)
Gets holds that have expired and should be auto-released.
Task<IReadOnlyList<LegalHold>> GetExpiredHoldsAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<LegalHold>>
List of expired holds.
ListActiveHoldsAsync(string?, DateTimeOffset, CancellationToken)
Lists all active holds.
Task<IReadOnlyList<LegalHold>> ListActiveHoldsAsync(string? tenantId, DateTimeOffset asOf, CancellationToken cancellationToken)
Parameters
tenantIdstringOptional tenant filter. Narrows the result to that tenant's holds plus every global hold.
asOfDateTimeOffsetThe instant the question is asked at. A hold is in force at
asOfwhen it was released at no point and has not lapsed by then. The caller supplies it so the answer is decidable and so several reads that must agree can be pinned to one instant.cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<LegalHold>>
List of active holds.
Remarks
A hold that belongs to no tenant is a global preservation order and is returned to every caller, including one who names a tenant. A legal hold blocks erasure, so a global order that a scoped read omits is one that has silently stopped blocking, and the deletion it should have prevented is irreversible. The tenant argument still excludes every OTHER tenant's holds.
ListAllHoldsAsync(string?, DateTimeOffset?, DateTimeOffset?, CancellationToken)
Lists all holds (active and released).
Task<IReadOnlyList<LegalHold>> ListAllHoldsAsync(string? tenantId, DateTimeOffset? fromDate, DateTimeOffset? toDate, CancellationToken cancellationToken)
Parameters
tenantIdstringOptional tenant filter. Narrows the result to that tenant's holds plus every global hold.
fromDateDateTimeOffset?Optional start date filter.
toDateDateTimeOffset?Optional end date filter.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<LegalHold>>
List of all holds.