pub struct FanOut {
pub outcomes: Vec<ProviderOutcome>,
}Expand description
The result of fanning one query out across all capability-matching providers.
Fields§
§outcomes: Vec<ProviderOutcome>One entry per provider that matched the query’s frame kinds, in registration order.
Implementations§
Source§impl FanOut
impl FanOut
Sourcepub fn accepted_frames(&self) -> impl Iterator<Item = &ContextFrame>
pub fn accepted_frames(&self) -> impl Iterator<Item = &ContextFrame>
Every frame from providers that passed the consent gate, the timeout, and the budget-honesty audit — the frames a host may honestly compose into a prompt.
Sourcepub fn total_accepted_tokens(&self) -> u64
pub fn total_accepted_tokens(&self) -> u64
The summed honest token cost of every accepted frame.
Sourcepub fn accepted_with_provider(
&self,
) -> impl Iterator<Item = (&str, &ContextFrame)>
pub fn accepted_with_provider( &self, ) -> impl Iterator<Item = (&str, &ContextFrame)>
Every accepted frame paired with the id of the provider that served it
— the input to deterministic composition (docs/context-reuse.md §1).
Sourcepub fn compose(&self) -> String
pub fn compose(&self) -> String
Compose every accepted frame into a byte-stable context block via the
deterministic composition contract — canonical order, relevance-free
rendering (docs/context-reuse.md §1). Two fan-outs over the same
frame set compose to identical bytes, so an unchanged turn extends the
provider’s prompt cache instead of busting it.
Sourcepub fn compose_for_prompt(&self, global_budget: u32) -> ComposedPrompt
pub fn compose_for_prompt(&self, global_budget: u32) -> ComposedPrompt
Compose every accepted frame into a prompt-ready block via the reference
composer (issue #15): the R3 evidence preamble, cross-provider-deduped and
value-ordered fenced frames packed under global_budget, a citation map,
and a CompositionAudit explaining
every included and excluded frame. Pair with
Host::query_all_budgeted: the fan-out
splits the budget across providers, and this packs the survivors under the
same whole so audit.tokens_used <= global_budget.
Sourcepub fn usage_report(
&self,
query: &ContextQuery,
as_of: impl Into<String>,
) -> UsageReport
pub fn usage_report( &self, query: &ContextQuery, as_of: impl Into<String>, ) -> UsageReport
Roll this fan-out up into a per-request UsageReport for metering
(docs/context-reuse.md §2). One ProviderUsage per provider the
query reached: accepted frames are itemized by stable identity and
declared cost, a budget-lying provider’s dropped frames count as
rejected, and a failed or consent-gated provider served nothing.
The report is a pure function of this fan-out plus the two host-supplied
scalars: budget_requested is the query’s max_tokens, and as_of is
the accounting snapshot time (an RFC 3339 string the host stamps — the
report’s own as-of, not the query’s bi-temporal as_of pin). The
result always satisfies UsageReport::is_consistent: its totals are
summed from the same served frames it itemizes.
Sourcepub fn failures(&self) -> impl Iterator<Item = (&str, &HostError)>
pub fn failures(&self) -> impl Iterator<Item = (&str, &HostError)>
Providers that failed (error, timeout, or crash), with their errors.
Sourcepub fn budget_liars(&self) -> impl Iterator<Item = &ProviderOutcome>
pub fn budget_liars(&self) -> impl Iterator<Item = &ProviderOutcome>
Providers whose frames were dropped for exceeding the query budget — the loud report the host must surface, never swallow (SPEC.md §7, B2).
Sourcepub fn frame_floods(&self) -> impl Iterator<Item = &ProviderOutcome>
pub fn frame_floods(&self) -> impl Iterator<Item = &ProviderOutcome>
Providers whose frames were dropped for exceeding max_frames — the
frame-count twin of budget_liars, surfaced
loudly rather than silently truncated (SPEC.md §7, B4).