pub struct ProxyState {
pub config: ProxyConfig,
pub client: Client,
pub validator: SchemaValidator,
pub assertions: Arc<RwLock<HashMap<String, AssertionSet>>>,
pub profiles: Vec<QomProfile>,
pub metrics: Arc<MetricsState>,
pub qom_recorder: Arc<QomRecorder>,
pub traffic_recorder: Arc<TrafficRecorder>,
pub pending_toc: Arc<RwLock<HashMap<String, PendingTocVerification>>>,
pub completed_toc: Arc<RwLock<HashMap<String, TocResult>>>,
/* private fields */
}Expand description
Shared proxy state
Fields§
§config: ProxyConfigConfiguration
client: ClientHTTP client for upstream requests
validator: SchemaValidatorSchema validator
assertions: Arc<RwLock<HashMap<String, AssertionSet>>>Assertions by SType (for IC computation)
profiles: Vec<QomProfile>QoM profiles
metrics: Arc<MetricsState>Metrics
qom_recorder: Arc<QomRecorder>QoM recorder for full metric tracking and persistence
traffic_recorder: Arc<TrafficRecorder>Traffic recorder for schema inference
pending_toc: Arc<RwLock<HashMap<String, PendingTocVerification>>>Pending TOC verifications (callback_id -> verification)
completed_toc: Arc<RwLock<HashMap<String, TocResult>>>Completed TOC results (callback_id -> result)
Implementations§
Source§impl ProxyState
impl ProxyState
Sourcepub async fn new(config: ProxyConfig) -> Result<Self>
pub async fn new(config: ProxyConfig) -> Result<Self>
Create a new proxy state from configuration
Sourcepub async fn with_options(
config: ProxyConfig,
data_dir: Option<&str>,
learning_enabled: bool,
) -> Result<Self>
pub async fn with_options( config: ProxyConfig, data_dir: Option<&str>, learning_enabled: bool, ) -> Result<Self>
Create a new proxy state with traffic recording options
Sourcepub fn next_toc_callback_id(&self) -> String
pub fn next_toc_callback_id(&self) -> String
Generate a unique TOC callback ID
Sourcepub fn register_pending_toc(&self, verification: PendingTocVerification)
pub fn register_pending_toc(&self, verification: PendingTocVerification)
Register a pending TOC verification
Sourcepub fn complete_toc(&self, callback_id: &str, result: TocResult) -> bool
pub fn complete_toc(&self, callback_id: &str, result: TocResult) -> bool
Complete a TOC verification (called from callback endpoint)
Sourcepub fn get_toc_result(&self, callback_id: &str) -> Option<TocResult>
pub fn get_toc_result(&self, callback_id: &str) -> Option<TocResult>
Get completed TOC result for a callback ID
Sourcepub fn get_pending_toc(
&self,
callback_id: &str,
) -> Option<PendingTocVerification>
pub fn get_pending_toc( &self, callback_id: &str, ) -> Option<PendingTocVerification>
Get pending TOC verification
Sourcepub fn parse_toc_header(value: &str) -> Option<TocResult>
pub fn parse_toc_header(value: &str) -> Option<TocResult>
Parse TOC result from header value
Sourcepub fn get_assertions(&self, stype: &str) -> Option<AssertionSet>
pub fn get_assertions(&self, stype: &str) -> Option<AssertionSet>
Get assertions for an SType
Sourcepub async fn validate_request(&self, envelope: &MplEnvelope) -> ValidationResult
pub async fn validate_request(&self, envelope: &MplEnvelope) -> ValidationResult
Validate an MPL request
Sourcepub async fn validate_request_full(
&self,
envelope: &MplEnvelope,
response: Option<&Value>,
) -> ValidationResult
pub async fn validate_request_full( &self, envelope: &MplEnvelope, response: Option<&Value>, ) -> ValidationResult
Validate an MPL request with optional response for determinism checking
Sourcepub async fn forward_request(
&self,
path: String,
request: Request<Body>,
) -> Result<Response<Body>>
pub async fn forward_request( &self, path: String, request: Request<Body>, ) -> Result<Response<Body>>
Forward a request to the upstream server
Sourcepub fn active_profile(&self) -> Option<&QomProfile>
pub fn active_profile(&self) -> Option<&QomProfile>
Get the active QoM profile
Sourcepub fn get_profile(&self, name: &str) -> Option<&QomProfile>
pub fn get_profile(&self, name: &str) -> Option<&QomProfile>
Get a profile by name
Sourcepub fn get_degradation_chain(&self, start_profile: &str) -> Vec<&QomProfile>
pub fn get_degradation_chain(&self, start_profile: &str) -> Vec<&QomProfile>
Get the degradation chain for a profile Returns profiles from strictest to most lenient
Sourcepub async fn validate_with_degradation(
&self,
envelope: &MplEnvelope,
) -> ValidationResult
pub async fn validate_with_degradation( &self, envelope: &MplEnvelope, ) -> ValidationResult
Validate with automatic profile degradation Returns (result, final_profile_name, was_degraded)
Source§impl ProxyState
impl ProxyState
Sourcepub fn handle_handshake(&self, hello: AiAlpnClientHello) -> AiAlpnServerSelect
pub fn handle_handshake(&self, hello: AiAlpnClientHello) -> AiAlpnServerSelect
Handle AI-ALPN handshake
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> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer