Skip to main content

Module admission

Module admission 

Source
Expand description

An opt-in admission gate for sends: a capacity, slots reserved per tenant, a bounded wait, priority classes and weighted fairness, all set by the server (audit H9, ADR 0045).

Without one, which is the default, a send the server has no room for is refused at once with Overloaded (503 with Retry-After). With one:

The tenant is the one the handler resolved for the request (TenantResolver); nothing the caller sends sets a priority.

use std::time::Duration;
use a2a_protocol_server::admission::{Admission, TenantShare};

let admission = Admission::new(256)
    .with_max_queued(1024)
    .with_max_wait(Duration::from_millis(500))
    .with_tenant(
        "premium",
        TenantShare::new().with_priority(1).with_weight(4).with_reserved(32),
    );
assert_eq!(admission.capacity(), 256);
assert_eq!(admission.share("premium").reserved(), 32);
assert_eq!(admission.share("anyone").weight(), 1);

Structs§

Admission
The admission gate’s configuration; see the module docs. Set it with RequestHandlerBuilder::with_admission.
AdmissionLoad
What an admission gate holds now: see RequestHandler::admission_load.
TenantShare
What one tenant gets from an Admission gate.