pub struct DockerRegistry { /* private fields */ }Expand description
DockerRegistry is a client for interacting with Docker’s Registry HTTP API v2. It handles authentication, image manifest retrieval, and blob fetching.
See OCI distribution specification for more details on the manifest schema
Implementations§
Source§impl DockerRegistry
impl DockerRegistry
Sourcepub fn get_client(&self) -> &ClientWithMiddleware
pub fn get_client(&self) -> &ClientWithMiddleware
The HTTP client used to make requests to the Docker registry.
Sourcepub fn get_layer_download_dir(&self) -> &PathBuf
pub fn get_layer_download_dir(&self) -> &PathBuf
The directory where image layers are downloaded.
Sourcepub fn get_oci_db(&self) -> &Pool<Sqlite>
pub fn get_oci_db(&self) -> &Pool<Sqlite>
The database where image configurations, indexes, and manifests are stored.
Source§impl DockerRegistry
impl DockerRegistry
Sourcepub fn set_client(&mut self, val: ClientWithMiddleware) -> &mut Self
pub fn set_client(&mut self, val: ClientWithMiddleware) -> &mut Self
The HTTP client used to make requests to the Docker registry.
Sourcepub fn set_layer_download_dir(&mut self, val: PathBuf) -> &mut Self
pub fn set_layer_download_dir(&mut self, val: PathBuf) -> &mut Self
The directory where image layers are downloaded.
Sourcepub fn set_oci_db(&mut self, val: Pool<Sqlite>) -> &mut Self
pub fn set_oci_db(&mut self, val: Pool<Sqlite>) -> &mut Self
The database where image configurations, indexes, and manifests are stored.
Source§impl DockerRegistry
impl DockerRegistry
Sourcepub async fn new(
layer_download_dir: impl Into<PathBuf>,
oci_db_path: impl AsRef<Path>,
) -> MicrosandboxResult<Self>
pub async fn new( layer_download_dir: impl Into<PathBuf>, oci_db_path: impl AsRef<Path>, ) -> MicrosandboxResult<Self>
Creates a new Docker Registry client with the specified image download path and OCI database path.
§Arguments
layer_download_dir- The directory where downloaded image layers will be storedoci_db_path- The path to the SQLite database that stores OCI-related metadata
Sourcepub async fn download_image_blob(
&self,
repository: &str,
digest: &Digest,
download_size: u64,
) -> MicrosandboxResult<bool>
pub async fn download_image_blob( &self, repository: &str, digest: &Digest, download_size: u64, ) -> MicrosandboxResult<bool>
Downloads a blob from the registry, supports download resumption if the file already partially exists.
Returns a tuple (MicrosandboxResult<()>, bool) where the boolean indicates whether a download actually occurred (true) or was skipped because the file already exists (false).
Trait Implementations§
Source§impl Debug for DockerRegistry
impl Debug for DockerRegistry
Source§impl OciRegistryPull for DockerRegistry
impl OciRegistryPull for DockerRegistry
Source§fn pull_image<'life0, 'life1, 'async_trait>(
&'life0 self,
repository: &'life1 str,
selector: ReferenceSelector,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pull_image<'life0, 'life1, 'async_trait>(
&'life0 self,
repository: &'life1 str,
selector: ReferenceSelector,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn fetch_index<'life0, 'life1, 'async_trait>(
&'life0 self,
repository: &'life1 str,
selector: ReferenceSelector,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageIndex>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_index<'life0, 'life1, 'async_trait>(
&'life0 self,
repository: &'life1 str,
selector: ReferenceSelector,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageIndex>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn fetch_manifest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageManifest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_manifest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageManifest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn fetch_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageConfiguration>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<ImageConfiguration>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn fetch_image_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
range: impl 'async_trait + RangeBounds<u64> + Send,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<BoxStream<'static, MicrosandboxResult<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_image_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repository: &'life1 str,
digest: &'life2 Digest,
range: impl 'async_trait + RangeBounds<u64> + Send,
) -> Pin<Box<dyn Future<Output = MicrosandboxResult<BoxStream<'static, MicrosandboxResult<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for DockerRegistry
impl !RefUnwindSafe for DockerRegistry
impl Send for DockerRegistry
impl Sync for DockerRegistry
impl Unpin for DockerRegistry
impl !UnwindSafe for DockerRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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