IAdapterLeaseParticipant
Namespace: Meshmakers.Octo.Sdk.Common.Adapters
One piece of the process that has to be set up when a lease starts and torn down when it ends (AB#4924, increment 6).
public interface IAdapterLeaseParticipant
Remarks:
๐ด This interface is the isolation invariant made composable. Concept ยง4: "between two leases the process must retain nothing tenant-scoped". The things that are tenant-scoped in a real adapter โ the access token, the CK model cache, the hub registration, the tenant repository handle โ do not live in one place and do not belong to this SDK. Rather than hard-coding a list the SDK cannot see, each of them registers a participant; the pool client enters them in registration order and leaves them in reverse order, like a stack.
The practical consequence is that "did this member really drop everything" becomes a question a test can answer by enumerating participants, rather than a claim somebody has to re-verify by reading code every time a cache is added.
IAdapterLeaseParticipant.LeaveLeaseAsync(LeaseDto, CancellationToken) runs on every path โ success, failure, drain โ and must not throw for a state it never entered. A participant whose leave is skipped because its enter failed is exactly how a tenant survives a release.
Methodsโ
EnterLeaseAsync(LeaseDto, CancellationToken)โ
Prepares this piece of the process for the borrowing tenant.
Task EnterLeaseAsync(LeaseDto lease, CancellationToken cancellationToken)
Parametersโ
lease LeaseDto
cancellationToken CancellationToken
Returnsโ
Remarks:
๐ด lease carries the borrower's client secret. It is lease-scoped: a
participant may use it to obtain a token, and must not persist it, write it to
configuration, or log it.
LeaveLeaseAsync(LeaseDto, CancellationToken)โ
Drops everything this piece of the process holds for the borrowing tenant.
Task LeaveLeaseAsync(LeaseDto lease, CancellationToken cancellationToken)
Parametersโ
lease LeaseDto
cancellationToken CancellationToken