Skip to main content

tenant_scoped_consumer

Function tenant_scoped_consumer 

Source
pub fn tenant_scoped_consumer(
    consumer: &OriginConsumer,
    tenant: &str,
) -> Option<OriginConsumer>
Expand description

Restrict an [OriginConsumer] to a single tenant’s broadcasts.

This is the live, network-side enforcement of per-tenant announce scoping: the returned consumer’s announced() cursor only ever yields broadcasts under {tenant}/, and subscribe/announced_broadcast for any path outside that prefix returns None. Hand the scoped consumer to moq_net::Server::with_publish for the accepted session and the peer cannot see — let alone subscribe to — another tenant’s broadcasts.

Returns None if the requested prefix is outside the consumer’s existing allowed prefixes (the moq-net scope contract); callers should treat that as “this tenant has no visible broadcasts” (serve an empty scope) rather than falling back to the unscoped consumer.