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.

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. default_token — the already-resolved --intelligence-token or its _FILE form — supplies endpoint 1’s value when its env override is unset, and applies to endpoint 1 only. 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 the configured intelligence.headers to every endpoint. Called once after construction, before any dial.

Source

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

Attach a per-request AWS SigV4 signer to every endpoint in the list.

Source

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

Select the wire dialect for every endpoint from intelligence.dialect. A host-only endpoint resolved its path with the OpenAI default before the dialect was known, so a still-defaulted path is re-pointed at the chosen dialect’s default. A path the operator wrote explicitly is left untouched, because they may be routing through a gateway mount. Bedrock overrides the path per request in any case.

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: the active index first, then the remaining endpoints in ascending list order, skipping any whose breaker is OPEN and still cooling. available promotes an endpoint whose cooldown has elapsed to HALF-OPEN, so it is probed here rather than skipped forever. An empty result means every endpoint is down.

Source

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

Snap active back to the lowest-index endpoint whose breaker is not OPEN. This is what makes the primary sticky: once it re-closes, the next call returns to it, so serving from a fallback is temporary by construction and a list never silently drifts onto its last entry. 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, i.e. every breaker is OPEN and still cooling.

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 and index ONLY — never the URL, host, cid or credential — matching the redaction the served resource body applies, so neither route can leak what the other withholds.

Source

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

The agentd://intelligence resource body: the endpoint list by transport and index, which one is active, and each one’s health — state, latency and error rate. It must contain no secret and no URL: only the bounded structural transport and addr (a bare host[:port], which cannot carry a scheme-borne credential) plus the live health atomics. Anything added here becomes readable by every holder of the resource.

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 = !

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