pub trait ContextProvider: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn info(&self) -> &ProviderInfo;
fn capabilities(&self) -> &Capabilities;
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;
// Provided methods
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 shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HostError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A registered Context Graph Protocol provider, queryable behind one handle regardless of
transport. info()/capabilities() return values cached at handshake
time, so they are cheap synchronous getters even for out-of-process
providers.
Required Methods§
Sourcefn 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).
Sourcefn info(&self) -> &ProviderInfo
fn info(&self) -> &ProviderInfo
Identity + declared data-flow direction, surfaced at consent time (SPEC.md §3, ).
Sourcefn capabilities(&self) -> &Capabilities
fn capabilities(&self) -> &Capabilities
Capabilities negotiated at the handshake (SPEC.md §3) — which frame kinds and filters this provider serves, whether it upserts, does graph, is an embedder, or supports subscriptions.
Sourcefn 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).
Provided Methods§
Sourcefn 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).
Defaults to answering Verdict::Unknown
for every requested identity, so an existing provider implements
nothing and is simply treated as unable to vouch for its frames — the
host then re-queries them. A provider that overrides this MUST also
advertise Capabilities::verify,
since the host only asks providers that declare support.
Sourcefn 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".