Trait KeptImages
pub trait KeptImages:
Send
+ Sync
+ 'static {
// Required methods
fn keep<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
media_type: &'life3 str,
bytes: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait;
fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ImageKeepError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
// Provided method
fn note_run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_scope: &'life1 str,
_run: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait { ... }
}Expand description
A place that keeps the bytes of images. Put in the agent’s state as an ImageStore.
An implementation keeps the bytes under (scope, sha256), refuses a sha256 that is not 64
lower-case hexadecimal digits or a scope that is not 32 of them, refuses bytes whose SHA-256 is
not the one given, checks the hash again when it loads (a local command can rewrite a file: a
changed one is ImageKeepError::Corrupt, never served), never lets one scope read another’s
image, and keeps what a worker that takes the run over can read. kept_images_conformance
checks it.
Required Methods§
fn keep<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
media_type: &'life3 str,
bytes: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
fn keep<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
media_type: &'life3 str,
bytes: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Keep bytes under sha256 for scope (the same bytes kept again are kept once).
§Errors
ImageKeepError::Malformed, ImageKeepError::Mismatch, ImageKeepError::Refused when
a bound is reached, ImageKeepError::Io.
fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 str,
sha256: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
The bytes kept under sha256 for scope.
§Errors
ImageKeepError::Malformed, ImageKeepError::NotFound (another scope’s image is a miss
like any other), ImageKeepError::Corrupt, ImageKeepError::Io.
Provided Methods§
fn note_run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_scope: &'life1 str,
_run: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn note_run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_scope: &'life1 str,
_run: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ImageKeepError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Note that run (the root run of the call, or one of the conversation) keeps images under
scope, so that whatever sweeps the keeper can ask the store whether the scope is still
wanted. Called before an image is kept. The default notes nothing: a keeper that nothing
sweeps needs none.
§Errors
ImageKeepError::Malformed, ImageKeepError::Io. A keeper that cannot note it is not
refused its images: the caller only logs.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".