ITenantManager Interface
Creates, changes and removes the tenants a store holds while the server runs, refusing a change the server's startup checks would refuse, so a tenant is never stored in a form the server would leave out.
public interface ITenantManagerDerived
↳ TenantManager
Remarks
Each change is judged against the tenants the store holds then and written through the store's ITenantStoreWriter. This instance then reads the store again to serve it at once; should that reading fail, or a created tenant not be readied to be served, it serves the change from its next reading that succeeds, and other instances serve it at their next reading. A change written is reported as made either way.
The changes of one instance are made one at a time. Two instances changing tenants at once may each pass the checks and together leave the store holding two tenants the checks refuse, such as two at one address: the readings then leave both out and log why, as for any tenant the store holds that the checks refuse.
Methods
ITenantManager.CreateAsync(TenantDefinition, CancellationToken) Method
Creates tenant under a new generation, so nothing kept for an earlier tenant of its id carries over to it.
System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Features.MultiTenancy.StoredTenant,Abblix.Oidc.Server.Features.MultiTenancy.TenantChangeRefusal>> CreateAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, System.Threading.CancellationToken cancellationToken);Parameters
tenant TenantDefinition
The tenant to create; its generation is assigned here.
cancellationToken System.Threading.CancellationToken
Cancels the change until it is written; after that it only stops the wait for this instance to serve the change, which is then reported as made.
Returns
System.Threading.Tasks.Task<Abblix.Utils.Result<StoredTenant,TenantChangeRefusal>>
The tenant as stored, or why it was refused.
Exceptions
System.InvalidOperationException
The store registers no ITenantStoreWriter.
ITenantManager.RemoveAsync(string, string, CancellationToken) Method
Removes the tenant stored under tenantId, while it is stored at version.
System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Features.MultiTenancy.StoredTenant,Abblix.Oidc.Server.Features.MultiTenancy.TenantChangeRefusal>> RemoveAsync(string tenantId, string version, System.Threading.CancellationToken cancellationToken);Parameters
tenantId System.String
The id of the tenant to remove.
version System.String
The version the tenant was read at.
cancellationToken System.Threading.CancellationToken
Cancels the change until it is written; after that it only stops the wait for this instance to serve the change, which is then reported as made.
Returns
System.Threading.Tasks.Task<Abblix.Utils.Result<StoredTenant,TenantChangeRefusal>>
The tenant as it was stored, or why the removal was refused.
Exceptions
System.InvalidOperationException
The store registers no ITenantStoreWriter.
ITenantManager.UpdateAsync(TenantDefinition, string, CancellationToken) Method
Replaces the tenant stored under the id of tenant, keeping its generation, while it is stored at version.
System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Features.MultiTenancy.StoredTenant,Abblix.Oidc.Server.Features.MultiTenancy.TenantChangeRefusal>> UpdateAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, string version, System.Threading.CancellationToken cancellationToken);Parameters
tenant TenantDefinition
The tenant as it is to be; a generation it names is not taken, the stored one is kept.
version System.String
The version the tenant was read at.
cancellationToken System.Threading.CancellationToken
Cancels the change until it is written; after that it only stops the wait for this instance to serve the change, which is then reported as made.
Returns
System.Threading.Tasks.Task<Abblix.Utils.Result<StoredTenant,TenantChangeRefusal>>
The tenant as stored, or why it was refused.
Exceptions
System.InvalidOperationException
The store registers no ITenantStoreWriter.