pub struct HttpProvider { /* private fields */ }Expand description
A ContextProvider backed by a remote HTTP endpoint. Handshakes once on
HttpProvider::connect and caches the negotiated identity + capabilities.
Implementations§
Source§impl HttpProvider
impl HttpProvider
Sourcepub async fn connect(
id: impl Into<String>,
url: impl Into<String>,
) -> Result<Self, HostError>
pub async fn connect( id: impl Into<String>, url: impl Into<String>, ) -> Result<Self, HostError>
Connect to a remote provider with no credential — a thin back-compat
wrapper over connect_with_auth. POST a
handshake, expect a compatible handshake_ack, and cache its identity
- capabilities.
idis the host-facing routing/consent key.
Sourcepub async fn connect_with_auth(
id: impl Into<String>,
url: impl Into<String>,
credential: Option<Credential>,
) -> Result<Self, HostError>
pub async fn connect_with_auth( id: impl Into<String>, url: impl Into<String>, credential: Option<Credential>, ) -> Result<Self, HostError>
Connect to a remote provider, optionally attaching a bearer
Credential to every request. Enforces transport security before any
bytes leave the host: a plaintext (http://) transport to a non-loopback
provider is refused with HostError::InsecureTransport, so neither the
handshake nor a credential ever crosses the network in cleartext
(SPEC.md §4.2, C7).
Trait Implementations§
Source§impl ContextProvider for HttpProvider
impl ContextProvider for HttpProvider
Source§fn id(&self) -> &str
fn id(&self) -> &str
The provider’s host-facing id — its routing key and its consent key
(
SPEC.md §4 and §10).Source§fn info(&self) -> &ProviderInfo
fn info(&self) -> &ProviderInfo
Identity + declared data-flow direction, surfaced at consent time
(SPEC.md §3, ).
Source§fn capabilities(&self) -> &Capabilities
fn capabilities(&self) -> &Capabilities
Capabilities negotiated at the handshake (
SPEC.md §3): which frame
kinds this provider serves, whether it echoes a correlation id, does
graph, names an embedding space, answers context/verify, which frame
representations it can return, and whether it answers context/resolve. Read moreSource§fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ContextQuery,
) -> Pin<Box<dyn Future<Output = Result<ContextQueryResult, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ContextQuery,
) -> Pin<Box<dyn Future<Output = Result<ContextQueryResult, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Answer a context query with budgeted, provenance-carrying frames
(SPEC.md §5). The host — not the provider — enforces the budget and consent;
a provider that over-runs its budget is caught by the host, not
trusted (
crate::host). Read moreSource§fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 VerifyRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyResponse, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 VerifyRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyResponse, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Revalidate frames the host already holds, without any frame body
travelling (
docs/context-reuse.md §4 context/verify). Read moreSource§fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shut the provider down cleanly (SPEC.md §3 lifecycle). In-process providers
default to a no-op; transport-backed providers send
shutdown and
reap their child. Overridable.Auto Trait Implementations§
impl !RefUnwindSafe for HttpProvider
impl !UnwindSafe for HttpProvider
impl Freeze for HttpProvider
impl Send for HttpProvider
impl Sync for HttpProvider
impl Unpin for HttpProvider
impl UnsafeUnpin for HttpProvider
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