Skip to main content

Module tenant_config

Module tenant_config 

Source
Expand description

Per-tenant configuration for multi-tenant A2A servers.

PerTenantConfig allows operators to differentiate service levels across tenants by setting per-tenant timeouts, capacity limits, rate limits, and other resource constraints.

§Example

use std::time::Duration;
use a2a_protocol_server::tenant_config::{PerTenantConfig, TenantLimits};

let config = PerTenantConfig::builder()
    .default_limits(TenantLimits::builder()
        .max_concurrent_tasks(100)
        .rate_limit_rps(50)
        .build())
    .with_override("premium-corp", TenantLimits::builder()
        .max_concurrent_tasks(1000)
        .executor_timeout(Duration::from_secs(120))
        .rate_limit_rps(500)
        .build())
    .build();

// "premium-corp" gets premium limits:
assert_eq!(config.get("premium-corp").max_concurrent_tasks, Some(1000));

// Unknown tenants get defaults:
assert_eq!(config.get("unknown").max_concurrent_tasks, Some(100));

Structs§

PerTenantConfig
Per-tenant configuration for timeouts, capacity limits, and executor selection.
PerTenantConfigBuilder
Builder for PerTenantConfig.
TenantLimits
Resource limits and configuration for a single tenant.
TenantLimitsBuilder
Builder for TenantLimits.