Skip to main content

ProxyState

Struct ProxyState 

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

Runtime-only state for the proxy process.

This state is intentionally not persisted across restarts.

Implementations§

Source§

impl ProxyState

Source

pub fn new() -> Arc<Self>

Source

pub fn new_with_lb_states( lb_states: Option<Arc<Mutex<HashMap<String, LbState>>>>, ) -> Arc<Self>

Source

pub async fn get_session_effort_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn get_session_reasoning_effort_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn set_session_effort_override( &self, session_id: String, effort: String, now_ms: u64, )

Source

pub async fn set_session_reasoning_effort_override( &self, session_id: String, reasoning_effort: String, now_ms: u64, )

Source

pub async fn clear_session_effort_override(&self, session_id: &str)

Source

pub async fn clear_session_reasoning_effort_override(&self, session_id: &str)

Source

pub async fn list_session_effort_overrides(&self) -> HashMap<String, String>

Source

pub async fn list_session_reasoning_effort_overrides( &self, ) -> HashMap<String, String>

Source

pub async fn touch_session_override(&self, session_id: &str, now_ms: u64)

Source

pub async fn touch_session_reasoning_effort_override( &self, session_id: &str, now_ms: u64, )

Source

pub async fn get_session_station_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn get_session_route_target_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn get_session_model_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn set_session_model_override( &self, session_id: String, model: String, now_ms: u64, )

Source

pub async fn clear_session_model_override(&self, session_id: &str)

Source

pub async fn list_session_model_overrides(&self) -> HashMap<String, String>

Source

pub async fn touch_session_model_override(&self, session_id: &str, now_ms: u64)

Source

pub async fn get_session_service_tier_override( &self, session_id: &str, ) -> Option<String>

Source

pub async fn set_session_service_tier_override( &self, session_id: String, service_tier: String, now_ms: u64, )

Source

pub async fn clear_session_service_tier_override(&self, session_id: &str)

Source

pub async fn list_session_service_tier_overrides( &self, ) -> HashMap<String, String>

Source

pub async fn touch_session_service_tier_override( &self, session_id: &str, now_ms: u64, )

Source

pub async fn get_session_binding( &self, session_id: &str, ) -> Option<SessionBinding>

Source

pub async fn list_session_bindings(&self) -> HashMap<String, SessionBinding>

Source

pub async fn get_session_route_affinity( &self, session_id: &str, ) -> Option<SessionRouteAffinity>

Source

pub async fn list_session_route_affinities( &self, ) -> HashMap<String, SessionRouteAffinity>

Source

pub async fn record_session_route_affinity_success( &self, session_id: &str, target: SessionRouteAffinityTarget, reason_hint: Option<String>, now_ms: u64, ) -> SessionRouteAffinity

Source

pub async fn set_session_binding(&self, binding: SessionBinding)

Source

pub async fn clear_session_binding(&self, session_id: &str)

Source

pub async fn clear_session_manual_overrides(&self, session_id: &str)

Source

pub async fn get_session_manual_overrides( &self, session_id: &str, ) -> SessionManualOverrides

Source

pub async fn list_session_manual_overrides( &self, ) -> HashMap<String, SessionManualOverrides>

Source

pub async fn apply_session_profile_binding( &self, service_name: &str, mgr: &ServiceConfigManager, session_id: String, profile_name: String, now_ms: u64, ) -> Result<()>

Source

pub async fn touch_session_binding(&self, session_id: &str, now_ms: u64)

Source

pub async fn set_session_station_override( &self, session_id: String, station_name: String, now_ms: u64, )

Source

pub async fn set_session_route_target_override( &self, session_id: String, target: String, now_ms: u64, )

Source

pub async fn clear_session_station_override(&self, session_id: &str)

Source

pub async fn clear_session_route_target_override(&self, session_id: &str)

Source

pub async fn list_session_station_overrides(&self) -> HashMap<String, String>

Source

pub async fn list_session_route_target_overrides( &self, ) -> HashMap<String, String>

Source

pub async fn touch_session_station_override( &self, session_id: &str, now_ms: u64, )

Source

pub async fn touch_session_route_target_override( &self, session_id: &str, now_ms: u64, )

Source

pub async fn get_global_station_override(&self) -> Option<String>

Source

pub async fn get_global_route_target_override(&self) -> Option<String>

Source

pub async fn set_global_station_override( &self, station_name: String, _now_ms: u64, )

Source

pub async fn set_global_route_target_override( &self, target: String, _now_ms: u64, )

Source

pub async fn clear_global_station_override(&self)

Source

pub async fn clear_global_route_target_override(&self)

Source

pub async fn get_runtime_default_profile_override( &self, service_name: &str, ) -> Option<String>

Source

pub async fn set_runtime_default_profile_override( &self, service_name: String, profile_name: String, now_ms: u64, )

Source

pub async fn clear_runtime_default_profile_override(&self, service_name: &str)

Source

pub async fn set_station_enabled_override( &self, service_name: &str, station_name: String, enabled: bool, now_ms: u64, )

Source

pub async fn set_station_level_override( &self, service_name: &str, station_name: String, level: u8, now_ms: u64, )

Source

pub async fn set_station_runtime_state_override( &self, service_name: &str, station_name: String, state: RuntimeConfigState, now_ms: u64, )

Source

pub async fn clear_station_enabled_override( &self, service_name: &str, station_name: &str, )

Source

pub async fn clear_station_level_override( &self, service_name: &str, station_name: &str, )

Source

pub async fn clear_station_runtime_state_override( &self, service_name: &str, station_name: &str, )

Source

pub async fn get_station_meta_overrides( &self, service_name: &str, ) -> HashMap<String, (Option<bool>, Option<u8>)>

Source

pub async fn get_station_runtime_state_overrides( &self, service_name: &str, ) -> HashMap<String, RuntimeConfigState>

Source

pub async fn set_provider_endpoint_enabled_override( &self, service_name: &str, endpoint_key: ProviderEndpointKey, enabled: bool, now_ms: u64, )

Source

pub async fn clear_provider_endpoint_enabled_override( &self, service_name: &str, endpoint_key: &ProviderEndpointKey, )

Source

pub async fn set_provider_endpoint_runtime_state_override( &self, service_name: &str, endpoint_key: ProviderEndpointKey, state: RuntimeConfigState, now_ms: u64, )

Source

pub async fn clear_provider_endpoint_runtime_state_override( &self, service_name: &str, endpoint_key: &ProviderEndpointKey, )

Source

pub async fn set_upstream_enabled_override( &self, service_name: &str, base_url: String, enabled: bool, now_ms: u64, )

Source

pub async fn clear_upstream_enabled_override( &self, service_name: &str, base_url: &str, )

Source

pub async fn set_upstream_runtime_state_override( &self, service_name: &str, base_url: String, state: RuntimeConfigState, now_ms: u64, )

Source

pub async fn clear_upstream_runtime_state_override( &self, service_name: &str, base_url: &str, )

Source

pub async fn get_upstream_meta_overrides( &self, service_name: &str, ) -> HashMap<String, (Option<bool>, Option<RuntimeConfigState>)>

Source

pub async fn route_plan_runtime_state_for_provider_endpoints( &self, service_name: &str, ) -> RoutePlanRuntimeState

Source

pub async fn record_provider_endpoint_attempt_success( &self, service_name: &str, endpoint_key: ProviderEndpointKey, now_ms: u64, )

Source

pub async fn record_provider_endpoint_attempt_failure( &self, service_name: &str, endpoint_key: ProviderEndpointKey, failure_threshold_cooldown_secs: u64, cooldown_backoff: CooldownBackoff, )

Source

pub async fn penalize_provider_endpoint_attempt( &self, service_name: &str, endpoint_key: ProviderEndpointKey, cooldown_secs: u64, cooldown_backoff: CooldownBackoff, )

Source

pub async fn set_provider_endpoint_usage_exhausted( &self, service_name: &str, endpoint_key: ProviderEndpointKey, exhausted: bool, )

Source

pub async fn prune_runtime_observability_for_service( &self, service_name: &str, mgr: &ServiceConfigManager, )

Source

pub async fn record_station_health( &self, service_name: &str, station_name: String, health: StationHealth, )

Source

pub async fn get_station_health( &self, service_name: &str, ) -> HashMap<String, StationHealth>

Source

pub async fn record_provider_balance_snapshot( &self, service_name: &str, snapshot: ProviderBalanceSnapshot, )

Source

pub async fn get_provider_balance_view( &self, service_name: &str, ) -> HashMap<String, Vec<ProviderBalanceSnapshot>>

Source

pub async fn get_provider_balance_summary_view( &self, service_name: &str, ) -> HashMap<String, StationRoutingBalanceSummary>

Source

pub async fn record_passive_upstream_success( &self, service_name: &str, station_name: &str, base_url: &str, status_code: Option<u16>, now_ms: u64, )

Source

pub async fn record_passive_upstream_failure( &self, params: PassiveUpstreamFailureRecord, )

Source

pub async fn get_lb_view(&self) -> HashMap<String, LbConfigView>

Source

pub async fn list_health_checks( &self, service_name: &str, ) -> HashMap<String, HealthCheckStatus>

Source

pub async fn try_begin_station_health_check( &self, service_name: &str, station_name: &str, total: usize, now_ms: u64, ) -> bool

Source

pub async fn request_cancel_station_health_check( &self, service_name: &str, station_name: &str, now_ms: u64, ) -> bool

Source

pub async fn is_station_health_check_cancel_requested( &self, service_name: &str, station_name: &str, ) -> bool

Source

pub async fn record_station_health_check_result( &self, service_name: &str, station_name: &str, now_ms: u64, upstream: UpstreamHealth, )

Source

pub async fn finish_station_health_check( &self, service_name: &str, station_name: &str, now_ms: u64, canceled: bool, )

Source

pub async fn get_usage_rollup_view( &self, service_name: &str, top_n: usize, days: usize, ) -> UsageRollupView

Source

pub async fn replay_usage_from_requests_log( &self, service_name: &str, log_path: PathBuf, base_url_to_provider_id: HashMap<String, String>, ) -> usize

Source

pub async fn resolve_session_cwd(&self, session_id: &str) -> Option<String>

Source

pub async fn begin_request( &self, service: &str, method: &str, path: &str, session_id: Option<String>, client_name: Option<String>, client_addr: Option<String>, cwd: Option<String>, model: Option<String>, reasoning_effort: Option<String>, service_tier: Option<String>, started_at_ms: u64, ) -> u64

Source

pub async fn update_request_route( &self, request_id: u64, station_name: Option<String>, provider_id: Option<String>, upstream_base_url: String, route_decision: Option<RouteDecisionProvenance>, )

Source

pub async fn finish_request(&self, params: FinishRequestParams)

Source

pub async fn list_active_requests(&self) -> Vec<ActiveRequest>

Source

pub async fn list_recent_finished(&self, limit: usize) -> Vec<FinishedRequest>

Source

pub async fn list_session_stats(&self) -> HashMap<String, SessionStats>

Source

pub async fn list_session_identity_cards( &self, recent_limit: usize, ) -> Vec<SessionIdentityCard>

Source

pub async fn enrich_session_identity_cards_with_cached_host_transcripts( &self, cards: &mut [SessionIdentityCard], )

Source

pub async fn list_session_identity_cards_with_host_transcripts( &self, recent_limit: usize, ) -> Vec<SessionIdentityCard>

Source

pub fn spawn_cleanup_task(state: Arc<Self>)

Trait Implementations§

Source§

impl Debug for ProxyState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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