Skip to main content

PushTarget

Trait PushTarget 

Source
pub trait PushTarget: Send + Sync {
    // Required methods
    fn upload_blob<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        reference: &'life1 str,
        digest: &'life2 str,
        media_type: &'life3 str,
        data: Vec<u8>,
        auth: &'life4 RegistryAuth,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn put_manifest<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        reference: &'life1 str,
        bytes: Vec<u8>,
        content_type: &'life2 str,
        auth: &'life3 RegistryAuth,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Abstraction over the wire-side push operations the WCOW builder needs.

Two implementations:

  • RegistryPushTarget — the real impl, wraps zlayer_registry::ImagePuller.
  • In-test recording doubles (see this module’s tests submodule) — capture which blobs were uploaded and which manifest bytes were PUT so unit tests can assert foreign layers are skipped and urls[] round-trips verbatim.

PushTarget is intentionally minimal: just “upload an arbitrary blob with this digest” and “PUT this manifest blob at this tag with this content type.” Everything WCOW-specific (foreign-layer detection, reading layer blobs off disk, computing the manifest’s Content-Type) lives in [push_impl] — the trait surface only describes registry-side primitives.

Required Methods§

Source

fn upload_blob<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, reference: &'life1 str, digest: &'life2 str, media_type: &'life3 str, data: Vec<u8>, auth: &'life4 RegistryAuth, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Upload a single blob, content-addressed by digest, to the registry under reference.

media_type is informational — the registry’s blob-upload endpoint does not key on it — but is plumbed through so backends that key off media type for observability can use it.

Source

fn put_manifest<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, reference: &'life1 str, bytes: Vec<u8>, content_type: &'life2 str, auth: &'life3 RegistryAuth, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

PUT the pre-serialised manifest blob bytes at reference with Content-Type: content_type. The bytes are sent verbatim so the foreign-layer urls[] array round-trips byte-identical between what BuiltImage::manifest_blob computed its digest over and what the registry indexes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§