Skip to main content

RegistryService

Struct RegistryService 

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

镜像仓库服务

提供镜像的拉取和推送功能,支持多种仓库类型。

Implementations§

Source§

impl RegistryService

Source

pub fn new(registry_type: RegistryType, endpoint: Option<&str>) -> Result<Self>

创建新的仓库服务

§参数
  • registry_type: 仓库类型
  • endpoint: 可选的仓库端点 URL
§返回
  • Result<Self>: 成功返回服务实例,失败返回错误
Source

pub fn new_docker_hub() -> Result<Self>

从 Docker Hub 创建服务(向后兼容)

§返回
  • Result<Self>: 成功返回 Docker Hub 服务实例,失败返回错误
Source

pub async fn pull_image(&self, image: &str, tag: &str) -> Result<ImageInfo>

拉取镜像

§参数
  • image: 镜像名称
  • tag: 镜像标签
§返回
  • Result<ImageInfo>: 成功返回镜像信息,失败返回错误
Source

pub async fn push_image(&self, image: &str, tag: &str) -> Result<ImageInfo>

推送镜像

§参数
  • image: 镜像名称
  • tag: 镜像标签
§返回
  • Result<ImageInfo>: 成功返回镜像信息,失败返回错误
Source

pub fn get_client(&self) -> Arc<DockerHubClient>

获取仓库客户端

§返回
  • Arc<DockerHubClient>: 仓库客户端实例
Source

pub fn get_downloader(&self) -> Arc<ImageDownloader>

获取镜像下载器

§返回
  • Arc<ImageDownloader>: 镜像下载器实例
Source

pub fn get_registry_type(&self) -> RegistryType

获取仓库类型

§返回
  • RegistryType: 当前服务的仓库类型

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, 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