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 attestation_ledger(&self) -> AttestationLedger
pub fn attestation_ledger(&self) -> AttestationLedger
Every accepted frame’s attestation state, keyed by identity
(SPEC.md §6.5,
ADR 0016).
A total account of the accepted frames: a frame the provider signed
nothing for is Unattested, so a
missing entry never has to be guessed at. Frames from a leg that served
none — failed, timed out, consent-gated, budget-dropped — are absent
because there is nothing to say about frames the host does not hold.
Sourcepub fn any_attested(&self) -> bool
pub fn any_attested(&self) -> bool
Whether any accepted frame is attested by a key this host trusts. A host rendering a “this evidence is signed” affordance asks this before drawing the chrome.
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.
Each audit entry also carries this fan-out’s
attestation_ledger state, so a reader can
tell attested evidence from unattested. It changes nothing about which
frames are chosen or where they land: acting on the state is a host’s
policy decision, and F9 forbids the composer from making it.
Ranks by raw score
(ScoreDescending); a host
with its own cross-provider policy calls
compose_for_prompt_with.
Sourcepub fn compose_for_prompt_with<S>(
&self,
global_budget: u32,
strategy: &S,
) -> ComposedPromptwhere
S: RankingStrategy + ?Sized,
pub fn compose_for_prompt_with<S>(
&self,
global_budget: u32,
strategy: &S,
) -> ComposedPromptwhere
S: RankingStrategy + ?Sized,
compose_for_prompt under an explicit
cross-provider ranking policy (SPEC.md §6.6, F10), still carrying this
fan-out’s attestation ledger into the audit.
The two are orthogonal by construction: the strategy decides which frames are packed and in what order, and the ledger only describes what was found about each one. Nothing here lets an attestation state move a frame, which is what keeps F9 true no matter which policy a host picks.
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).