Struct ImageProxy

Source
pub struct ImageProxy { /* private fields */ }
Expand description

Manage a child process proxy to fetch container images.

Implementations§

Source§

impl ImageProxy

Source

pub async fn new() -> Result<Self>

Create an image proxy that fetches the target image, using default configuration.

Source

pub async fn new_with_config(config: ImageProxyConfig) -> Result<Self>

Create an image proxy that fetches the target image

Source

pub async fn open_image(&self, imgref: &str) -> Result<OpenedImage>

Source

pub async fn open_image_optional( &self, imgref: &str, ) -> Result<Option<OpenedImage>>

Source

pub async fn close_image(&self, img: &OpenedImage) -> Result<()>

Source

pub async fn fetch_manifest_raw_oci( &self, img: &OpenedImage, ) -> Result<(String, Vec<u8>)>

Fetch the manifest as raw bytes, converted to OCI if necessary. The original digest of the unconverted manifest is also returned. For more information on OCI manifests, see https://github.com/opencontainers/image-spec/blob/main/manifest.md

Source

pub async fn fetch_manifest( &self, img: &OpenedImage, ) -> Result<(String, ImageManifest)>

Fetch the manifest. For more information on OCI manifests, see https://github.com/opencontainers/image-spec/blob/main/manifest.md

Source

pub async fn fetch_config_raw(&self, img: &OpenedImage) -> Result<Vec<u8>>

Fetch the config. For more information on OCI config, see https://github.com/opencontainers/image-spec/blob/main/config.md

Source

pub async fn fetch_config( &self, img: &OpenedImage, ) -> Result<ImageConfiguration>

Fetch the config. For more information on OCI config, see https://github.com/opencontainers/image-spec/blob/main/config.md

Source

pub async fn get_blob( &self, img: &OpenedImage, digest: &Digest, size: u64, ) -> Result<(impl AsyncBufRead + Send + Unpin, impl Future<Output = Result<()>> + Unpin + '_)>

Fetch a blob identified by e.g. sha256:<digest>. https://github.com/opencontainers/image-spec/blob/main/descriptor.md

The requested size and digest are verified (by the proxy process).

Note that because of the implementation details of this function, you should [futures::join!] the returned futures instead of polling one after the other. The secondary “driver” future will only return once everything has been read from the reader future.

Source

pub async fn get_raw_blob( &self, img: &OpenedImage, digest: &Digest, ) -> Result<(u64, File, impl Future<Output = Result<(), GetBlobError>> + Unpin + '_)>

Fetch a blob identified by e.g. sha256:<digest>; does not perform any verification that the blob matches the digest. The size of the blob and a pipe file descriptor are returned.

Source

pub async fn get_descriptor( &self, img: &OpenedImage, descriptor: &Descriptor, ) -> Result<(impl AsyncBufRead + Send + Unpin, impl Future<Output = Result<()>> + Unpin + '_)>

Fetch a descriptor. The requested size and digest are verified (by the proxy process).

Source

pub async fn get_layer_info( &self, img: &OpenedImage, ) -> Result<Option<Vec<ConvertedLayerInfo>>>

Returns data that can be used to find the “diffid” corresponding to a particular layer.

Source

pub async fn finalize(self) -> Result<()>

Close the connection and wait for the child process to exit successfully.

Trait Implementations§

Source§

impl Debug for ImageProxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more