PlaidEx.MultiTenant.TenantSupervisor (plaid_ex v1.0.0)

Copy Markdown View Source

DynamicSupervisor managing per-tenant process subtrees.

Each tenant gets an isolated Tenant GenServer that owns:

  • Its own rate limiter token bucket (via TenantRegistry metadata)
  • Its own circuit breaker references
  • Lifecycle management (start/stop/restart)

For most use cases, PlaidEx.Config.TenantRegistry is sufficient. Use this supervisor when you need active per-tenant processes (e.g., dedicated sync workers, polling loops).

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a tenant subtree if not already running.

Stops a tenant's subtree.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

ensure_tenant(tenant_id, config)

@spec ensure_tenant(String.t(), PlaidEx.Config.t()) :: {:ok, pid()} | {:error, term()}

Starts a tenant subtree if not already running.

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()

stop_tenant(tenant_id)

@spec stop_tenant(String.t()) :: :ok | {:error, :not_found}

Stops a tenant's subtree.