TTenantProvisioner Class
Idempotent tenant lifecycle operations over an ITenantCatalog: create a tenant (with pluggable shard allocation), change its status, move it to another shard.
Remarks
Every write invalidates the routing cache (when one is provided), so changes are effective immediately without waiting for the cache TTL. The provisioner does not move data nor create databases by itself: it maintains the catalog and gives the application the OnProvisionShard and OnProvisionTenant callbacks to do that work.
Syntax
Unit: Aurelius.Tenancy.Provisioning
TTenantProvisioner = class(TObject);
Constructors
| Name | Description |
|---|---|
| Create | Creates a new TTenantProvisioner instance. |
Methods
| Name | Description |
|---|---|
| ActivateTenant | Sets the status of a tenant to Active. |
| AddTenant | Creates the tenant if it does not exist yet and returns its catalog record. |
| DisableTenant | Sets the status of a tenant to Disabled, blocking its requests immediately. |
| MoveTenantToShard | Points the tenant to another shard. |
| RemoveIdentifier | Removes an external identifier and invalidates its cached mapping. Nothing happens if the identifier is unknown. |
| SaveIdentifier | Associates an external identifier (an API client id, a custom domain, a user id) with a tenant, replacing any previous association of the same identifier. |
| SetTenantStatus | Sets the status of a tenant and invalidates its cached routing information. |
| SuspendTenant | Sets the status of a tenant to Suspended, blocking its requests immediately. |
Properties
| Name | Description |
|---|---|
| ActivateOnProvision | Indicates whether a tenant becomes Active automatically at the end of a successful AddTenant. |
| Allocator | Gets or sets the shard allocation strategy used by AddTenant when no shard id is given. |
| OnProvisionShard | Callback invoked by AddTenant when the tenant's shard has no catalog record yet, before the tenant itself is provisioned. |
| OnProvisionTenant | Callback invoked by AddTenant while provisioning a tenant (new or still pending). |