pub trait ExternalStateStore: Send + Sync {
// Required methods
fn resolve<'a>(
&'a self,
reference: &'a ExternalStateReference,
) -> impl Future<Output = Result<Vec<u8>, ExternalStateError>> + Send + 'a;
fn store<'a>(
&'a self,
bytes: &'a [u8],
) -> impl Future<Output = Result<ExternalStateReference, ExternalStateError>> + Send + 'a;
}Expand description
A capability an adapter may implement to resolve and store external component state.
ADR-0008-shaped: a generic trait with an explicit call lifetime and an
opaque future return, matching the item-component contract’s conventions.
No concrete adapter ships with #144.
Required Methods§
Sourcefn resolve<'a>(
&'a self,
reference: &'a ExternalStateReference,
) -> impl Future<Output = Result<Vec<u8>, ExternalStateError>> + Send + 'a
fn resolve<'a>( &'a self, reference: &'a ExternalStateReference, ) -> impl Future<Output = Result<Vec<u8>, ExternalStateError>> + Send + 'a
Resolves the bytes a reference identifies.
§Errors
Returns ExternalStateError::ContentMissing when the referenced
content cannot be found, or
ExternalStateError::ContentMismatch when the resolved bytes do not
match the declared content identity.
Sourcefn store<'a>(
&'a self,
bytes: &'a [u8],
) -> impl Future<Output = Result<ExternalStateReference, ExternalStateError>> + Send + 'a
fn store<'a>( &'a self, bytes: &'a [u8], ) -> impl Future<Output = Result<ExternalStateReference, ExternalStateError>> + Send + 'a
Stores bytes and returns their bounded, content-identified reference.
§Errors
Returns ExternalStateError::StoreFailed when the adapter cannot
durably retain the bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".