Skip to content

ITenantStoreWriter Interface

Writes to a store of tenants, for a host that changes its tenants through ITenantManager.

C#
public interface ITenantStoreWriter

Remarks

Registered beside an ITenantStore of the host's own that reads what it writes: beside the tenants of the settings, which nothing writes to, the server does not start. A store the host writes to by other means needs none. Each change of a stored tenant names the version it was read at and is applied only while the store still holds that version, as one conditional write, so a change made meanwhile by another instance is never overwritten unseen.

Registered as a singleton, as the store is: the manager that takes it lives for the life of the process, so a writer registered for a request would be held for every request after the first, and a container validating its scopes refuses it at startup.

Methods

ITenantStoreWriter.AddAsync(TenantDefinition, CancellationToken) Method

Adds tenant, unless the store holds a tenant under its id already.

C#
System.Threading.Tasks.Task<string?> AddAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, System.Threading.CancellationToken cancellationToken);

Parameters

tenant TenantDefinition

The tenant to add, its generation assigned.

cancellationToken System.Threading.CancellationToken

Cancels the write.

Returns

System.Threading.Tasks.Task<System.String>
The version the tenant is stored at; null when the store holds a tenant under its id.

ITenantStoreWriter.RemoveAsync(string, string, CancellationToken) Method

Removes the tenant stored under tenantId, while it is stored at expectedVersion.

C#
System.Threading.Tasks.Task<bool> RemoveAsync(string tenantId, string expectedVersion, System.Threading.CancellationToken cancellationToken);

Parameters

tenantId System.String

The id of the tenant to remove.

expectedVersion System.String

The version the tenant was read at.

cancellationToken System.Threading.CancellationToken

Cancels the write.

Returns

System.Threading.Tasks.Task<System.Boolean>
Whether the tenant was removed; false when it is stored at another version or not at all.

ITenantStoreWriter.UpdateAsync(TenantDefinition, string, CancellationToken) Method

Replaces the tenant stored under the id of tenant, while it is stored at expectedVersion.

C#
System.Threading.Tasks.Task<string?> UpdateAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, string expectedVersion, System.Threading.CancellationToken cancellationToken);

Parameters

tenant TenantDefinition

The tenant as it is to be stored.

expectedVersion System.String

The version the tenant was read at.

cancellationToken System.Threading.CancellationToken

Cancels the write.

Returns

System.Threading.Tasks.Task<System.String>
The version the tenant is stored at now; null when it is stored at another version or not at all.