Skip to main content

ImageSource

Trait ImageSource 

Source
pub trait ImageSource: Debug {
    // Required methods
    fn reference(&self) -> Box<dyn ImageReference>;
    fn get_manifest<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        digest: Option<&'life1 Digest>,
    ) -> Pin<Box<dyn Future<Output = ImageResult<ImageManifest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_blob<'life0, 'life1, 'async_trait>(
        &'life0 self,
        digest: &'life1 Digest,
    ) -> Pin<Box<dyn Future<Output = ImageResult<Box<dyn AsyncRead + Unpin + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_repo_tags<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ImageResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait that should be implemented by All Image Sources.

An ImageSource is an ImageReference and a client. The ‘client’ for the image source handles ‘transport’ specific details. Thus we’ll have an ImageSource for every soupported transport. Right now we are supporting only ‘docker’ (Repo V2) and ‘oci’ (local FS - TODO).

Required Methods§

Source

fn reference(&self) -> Box<dyn ImageReference>

Returns a Reference corresponding to this particular ImageSource.

Source

fn get_manifest<'life0, 'life1, 'async_trait>( &'life0 mut self, digest: Option<&'life1 Digest>, ) -> Pin<Box<dyn Future<Output = ImageResult<ImageManifest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the manifest using this ImageSource.

If the passed Digest is None, it means - Get the manifest for the reference, this source points to. Usually it means getting the manifest for the ‘digest’ if present in the reference or the ‘tag’ (default if not present) for the reference. When we explicitly pass the Digest, we are interested in manifest corresponding to this specific digest (Which usually is the manifest for the ‘Image’ if the previous manifest was a ‘list’ or ‘index’ type.)

Source

fn get_blob<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 Digest, ) -> Pin<Box<dyn Future<Output = ImageResult<Box<dyn AsyncRead + Unpin + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a blob for the image

It is up to the caller to decide whether the requested blob is a ‘config’ or a ‘layer’ blob.

Source

fn get_repo_tags<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ImageResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all tags for this Image source

Get’s all tags corresponding to this Image Source. Note: Right now this makes sense only for the ‘docker’ Image sources, for other image sources, simply return an Empty List.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§