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<ProxyState>

Source

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

Source

pub async fn get_session_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 clear_session_effort_override(&self, session_id: &str)

Source

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

Source

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

Source

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

Source

pub async fn set_session_config_override( &self, session_id: String, config_name: String, now_ms: u64, )

Source

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

Source

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

Source

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

Source

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

Source

pub async fn set_global_config_override( &self, config_name: String, _now_ms: u64, )

Source

pub async fn clear_global_config_override(&self)

Source

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

Source

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

Source

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

Source

pub async fn record_config_health( &self, service_name: &str, config_name: String, health: ConfigHealth, )

Source

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

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_health_check( &self, service_name: &str, config_name: &str, total: usize, now_ms: u64, ) -> bool

Source

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

Source

pub async fn is_health_check_cancel_requested( &self, service_name: &str, config_name: &str, ) -> bool

Source

pub async fn record_health_check_result( &self, service_name: &str, config_name: &str, now_ms: u64, upstream: UpstreamHealth, )

Source

pub async fn finish_health_check( &self, service_name: &str, config_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>, cwd: Option<String>, model: Option<String>, reasoning_effort: Option<String>, started_at_ms: u64, ) -> u64

Source

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

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 fn spawn_cleanup_task(state: Arc<ProxyState>)

Trait Implementations§

Source§

impl Debug for ProxyState

Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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