Skip to main content

SystemProxy

Trait SystemProxy 

Source
pub trait SystemProxy: Send + Sync {
    // Required methods
    fn wants(&self, request: &SystemRequest) -> bool;
    fn evaluate<'life0, 'async_trait>(
        &'life0 self,
        request: SystemRequest,
        caller_key: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<ProxyOutcome, ApiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn models<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<ModelsResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn forwards_caller_credentials(&self) -> bool { ... }
}
Expand description

The proxy-cache hook the daemon installs.

Required Methods§

Source

fn wants(&self, request: &SystemRequest) -> bool

Whether this hook wants to handle a request (e.g. its model is a proxied alias). Cheap and synchronous.

Source

fn evaluate<'life0, 'async_trait>( &'life0 self, request: SystemRequest, caller_key: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<ProxyOutcome, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle the request: answer locally when the cache is confident, otherwise forward upstream with the caller’s credentials.

Source

fn models<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<ModelsResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upstream /v1/models listing when the proxy should answer model discovery transparently; None falls back to the local registry.

Provided Methods§

Source

fn forwards_caller_credentials(&self) -> bool

Whether the proxy forwards caller credentials to the upstream Jev API.

When false (for example, when a fixed upstream key is configured on the daemon), the HTTP handler does not extract the inbound Authorization bearer token or supply it to Self::evaluate, preventing local daemon bearer credentials from crossing the proxy boundary.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§