Skip to main content

EndpointList

Struct EndpointList 

Source
pub struct EndpointList { /* private fields */ }
Expand description

The ordered endpoint list with the sticky-primary active cursor (§3.3).

Implementations§

Source§

impl EndpointList

Source

pub fn parse( uri: &str, default_token: Option<String>, ) -> Result<EndpointList, IntelError>

Parse the comma-list uri into an ordered EndpointList, resolving each endpoint’s credential. The single default_token is endpoint 1’s value when the env override is unset (it is the already-resolved --intelligence-token/_FILE, RFC 0006). Per-endpoint env overrides (AGENTD_INTELLIGENCE_TOKEN_<N> / _FILE) win when present.

Source

pub fn parse_with_env( uri: &str, default_token: Option<String>, env: &dyn Fn(&str) -> Option<String>, ) -> Result<EndpointList, IntelError>

parse with an injectable env reader (for tests).

Source

pub fn set_extra_headers(&mut self, headers: Vec<(String, String)>)

Apply extra request headers (RFC 0031 intelligence.headers) to every endpoint. Cheap; called once after construction.

Source

pub fn set_signer(&mut self, signer: Arc<dyn RequestSigner>)

Attach a per-request signer (RFC 0031: AWS SigV4) to every endpoint.

Source

pub fn set_provider(&mut self, provider: Provider)

Select the wire dialect for every endpoint (RFC 0031 §8 — intelligence.dialect). A host-only endpoint resolved its path with the OpenAI default, so re-point a still-defaulted path to the new dialect’s default (Bedrock overrides the path per-request regardless; an explicit non-default path is left untouched).

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn active(&self) -> usize

Source

pub fn breaker_config(&self) -> &BreakerConfig

Source

pub fn ep(&self, idx: usize) -> &Endpoint

Source

pub fn iter(&self) -> impl Iterator<Item = &Endpoint>

Source

pub fn attempt_order(&self) -> Vec<usize>

The failover attempt order (§3.3): the active index first, then the remaining endpoints in ascending list order, skipping any whose breaker is OPEN-and-cooling (available promotes an elapsed-cooldown endpoint to HALF-OPEN so it is probed). An empty result == all endpoints down (§6).

Source

pub fn prefer_lowest_healthy(&mut self) -> Option<usize>

Snap active back to the lowest-index endpoint whose breaker is not OPEN (sticky-primary, §3.3) — so once the primary re-closes, the next call returns to it and a fallback is temporary by construction. Returns the new active index if it changed.

Source

pub fn set_active(&mut self, idx: usize) -> Option<usize>

Mark idx as the active endpoint (it just succeeded). Returns the new active index if it changed.

Source

pub fn all_down(&self) -> bool

True when no endpoint is available — every breaker OPEN-and-cooling (§6).

Source

pub fn active_identity(&self) -> (usize, &'static str)

The active endpoint’s bounded structural identity (index, transport-scheme) for the child→supervisor crate::subagent::protocol::AgentMsg::IntelHealth report — transport + index ONLY, NEVER the URL/cid/host or credential (RFC 0012 §3.7, mirroring the §4.4 resource-body redaction).

Source

pub fn body(&self, model: Option<&str>) -> Value

The agentd://intelligence resource body (RFC 0018 §4.4): the endpoint list (transport + index, NEVER the URL/creds), which is active, and each one’s health (state/latency/error-rate). No secret, no URL (RFC 0012 §3.7) — only the bounded structural transport+addr (cid:port / host, no scheme-borne secret) and the live atomics.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more