Struct ImageManager

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

综合镜像管理器 - 4种操作模式的统一入口

Implementations§

Source§

impl ImageManager

Source

pub fn new(cache_dir: Option<&str>, verbose: bool) -> Result<Self>

创建新的镜像管理器

Examples found in repository?
examples/basic_usage_demo.rs (line 130)
121async fn demo_pull_and_cache(
122    logger: &Logger,
123    cache_dir: &str,
124    _username: &str,
125    _password: &str,
126) -> Result<()> {
127    logger.info("Demonstrating pull and cache workflow...");
128    
129    // Create image manager
130    let mut _image_manager = ImageManager::new(Some(cache_dir), true)?;
131    
132    println!("🔽 Would pull nginx:latest from Docker Hub");
133    println!("💾 Would cache image locally in: {}", cache_dir);
134    
135    // In production, you would use:
136    // let operation = OperationMode::PullAndCache {
137    //     registry_url: "https://registry-1.docker.io".to_string(),
138    //     repository: "library/nginx".to_string(),
139    //     reference: "latest".to_string(),
140    //     cache_dir: cache_dir.to_string(),
141    //     auth_config: Some(auth_config),
142    // };
143    
144    logger.info("Pull and cache operation configured (demo mode)");
145    
146    Ok(())
147}
Source

pub fn with_config( cache_dir: Option<&str>, verbose: bool, use_optimized_upload: bool, ) -> Result<Self>

创建镜像管理器,并允许配置优化选项

Source

pub async fn execute_operation( &mut self, mode: &OperationMode, client: Option<&RegistryClient>, auth_token: Option<&str>, ) -> Result<()>

执行指定的操作模式 - 统一入口点

Source

pub async fn execute_push_from_cache_with_source( &mut self, source_repository: &str, source_reference: &str, target_repository: &str, target_reference: &str, client: Option<&RegistryClient>, auth_token: Option<&str>, ) -> Result<()>

执行推送操作(支持源和目标坐标分离)

Source

pub fn get_cache_stats(&self) -> Result<CacheStats>

获取缓存统计信息

Source

pub fn list_cached_images(&self) -> Vec<(String, String)>

列出缓存中的所有镜像

Source

pub fn is_image_cached(&self, repository: &str, reference: &str) -> Result<bool>

检查镜像是否在缓存中

Source

pub fn configure_pipeline(&mut self, config: PipelineConfig)

配置流式处理管道参数

Source

pub fn set_optimized_upload(&mut self, enabled: bool)

设置是否使用优化的上传模式

Source

pub fn get_config(&self) -> (bool, &PipelineConfig)

获取当前配置状态

Source

pub fn get_logger(&self) -> &Logger

获取Logger引用

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,