AuroraMeter.Tenant behaviour (Aurora Meter v0.1.0)

View Source

Resolves an opaque tenant term into a stable string key.

Tenants are never assumed to be strings or integers — a host may pass a struct, a tuple, or any identifier. The configured implementation (:tenant, default AuroraMeter.Tenant.Default) turns it into the tenant_key used everywhere in storage, ETS, and PubSub topics.

Summary

Callbacks

Converts a tenant term into its stable string key.

Functions

Resolves tenant to its string key via the configured implementation.

Callbacks

to_key(tenant)

@callback to_key(tenant :: term()) :: String.t()

Converts a tenant term into its stable string key.

Functions

to_key(tenant)

@spec to_key(term()) :: String.t()

Resolves tenant to its string key via the configured implementation.

Examples

iex> AuroraMeter.Tenant.to_key("org_42")
"org_42"