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
impl ProxyState
pub fn new() -> Arc<ProxyState>
pub fn new_with_lb_states( lb_states: Option<Arc<Mutex<HashMap<String, LbState>>>>, ) -> Arc<ProxyState>
pub async fn get_session_effort_override( &self, session_id: &str, ) -> Option<String>
pub async fn set_session_effort_override( &self, session_id: String, effort: String, now_ms: u64, )
pub async fn clear_session_effort_override(&self, session_id: &str)
pub async fn list_session_effort_overrides(&self) -> HashMap<String, String>
pub async fn touch_session_override(&self, session_id: &str, now_ms: u64)
pub async fn get_session_config_override( &self, session_id: &str, ) -> Option<String>
pub async fn set_session_config_override( &self, session_id: String, config_name: String, now_ms: u64, )
pub async fn clear_session_config_override(&self, session_id: &str)
pub async fn list_session_config_overrides(&self) -> HashMap<String, String>
pub async fn touch_session_config_override(&self, session_id: &str, now_ms: u64)
pub async fn get_global_config_override(&self) -> Option<String>
pub async fn set_global_config_override( &self, config_name: String, _now_ms: u64, )
pub async fn clear_global_config_override(&self)
pub async fn set_config_enabled_override( &self, service_name: &str, config_name: String, enabled: bool, now_ms: u64, )
pub async fn set_config_level_override( &self, service_name: &str, config_name: String, level: u8, now_ms: u64, )
pub async fn get_config_meta_overrides( &self, service_name: &str, ) -> HashMap<String, (Option<bool>, Option<u8>)>
pub async fn record_config_health( &self, service_name: &str, config_name: String, health: ConfigHealth, )
pub async fn get_config_health( &self, service_name: &str, ) -> HashMap<String, ConfigHealth>
pub async fn get_lb_view(&self) -> HashMap<String, LbConfigView>
pub async fn list_health_checks( &self, service_name: &str, ) -> HashMap<String, HealthCheckStatus>
pub async fn try_begin_health_check( &self, service_name: &str, config_name: &str, total: usize, now_ms: u64, ) -> bool
pub async fn request_cancel_health_check( &self, service_name: &str, config_name: &str, now_ms: u64, ) -> bool
pub async fn is_health_check_cancel_requested( &self, service_name: &str, config_name: &str, ) -> bool
pub async fn record_health_check_result( &self, service_name: &str, config_name: &str, now_ms: u64, upstream: UpstreamHealth, )
pub async fn finish_health_check( &self, service_name: &str, config_name: &str, now_ms: u64, canceled: bool, )
pub async fn get_usage_rollup_view( &self, service_name: &str, top_n: usize, days: usize, ) -> UsageRollupView
pub async fn replay_usage_from_requests_log( &self, service_name: &str, log_path: PathBuf, base_url_to_provider_id: HashMap<String, String>, ) -> usize
pub async fn resolve_session_cwd(&self, session_id: &str) -> Option<String>
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
pub async fn update_request_route( &self, request_id: u64, config_name: String, provider_id: Option<String>, upstream_base_url: String, )
pub async fn finish_request(&self, params: FinishRequestParams)
pub async fn list_active_requests(&self) -> Vec<ActiveRequest>
pub async fn list_recent_finished(&self, limit: usize) -> Vec<FinishedRequest>
pub async fn list_session_stats(&self) -> HashMap<String, SessionStats>
pub fn spawn_cleanup_task(state: Arc<ProxyState>)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProxyState
impl !RefUnwindSafe for ProxyState
impl Send for ProxyState
impl Sync for ProxyState
impl Unpin for ProxyState
impl UnwindSafe for ProxyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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