Skip to main content

TenantResolver

Trait TenantResolver 

Source
pub trait TenantResolver:
    Send
    + Sync
    + 'static {
    // Required method
    fn resolve<'a>(
        &'a self,
        ctx: &'a CallContext,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'a>>;
}
Expand description

Trait for extracting a tenant identifier from incoming requests.

Implement this to customize how tenant identity is determined — e.g. from HTTP headers, JWT claims, URL path segments, or API keys.

§Object safety

This trait is designed to be used behind Arc<dyn TenantResolver>.

§Return value

None means no tenant could be determined; the server should use its default partition / configuration.

Required Methods§

Source

fn resolve<'a>( &'a self, ctx: &'a CallContext, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'a>>

Extracts the tenant identifier from the given call context.

Returns None if no tenant can be determined (uses default partition).

Implementors§