pub struct ImageManager { /* private fields */ }
Expand description
综合镜像管理器 - 4种操作模式的统一入口
Implementations§
Source§impl ImageManager
impl ImageManager
Sourcepub fn new(cache_dir: Option<&str>, verbose: bool) -> Result<Self>
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}
Sourcepub fn with_config(
cache_dir: Option<&str>,
verbose: bool,
use_optimized_upload: bool,
) -> Result<Self>
pub fn with_config( cache_dir: Option<&str>, verbose: bool, use_optimized_upload: bool, ) -> Result<Self>
创建镜像管理器,并允许配置优化选项
Sourcepub async fn execute_operation(
&mut self,
mode: &OperationMode,
client: Option<&RegistryClient>,
auth_token: Option<&str>,
) -> Result<()>
pub async fn execute_operation( &mut self, mode: &OperationMode, client: Option<&RegistryClient>, auth_token: Option<&str>, ) -> Result<()>
执行指定的操作模式 - 统一入口点
Sourcepub 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<()>
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<()>
执行推送操作(支持源和目标坐标分离)
Sourcepub fn get_cache_stats(&self) -> Result<CacheStats>
pub fn get_cache_stats(&self) -> Result<CacheStats>
获取缓存统计信息
Sourcepub fn list_cached_images(&self) -> Vec<(String, String)>
pub fn list_cached_images(&self) -> Vec<(String, String)>
列出缓存中的所有镜像
Sourcepub fn configure_pipeline(&mut self, config: PipelineConfig)
pub fn configure_pipeline(&mut self, config: PipelineConfig)
配置流式处理管道参数
Sourcepub fn set_optimized_upload(&mut self, enabled: bool)
pub fn set_optimized_upload(&mut self, enabled: bool)
设置是否使用优化的上传模式
Sourcepub fn get_config(&self) -> (bool, &PipelineConfig)
pub fn get_config(&self) -> (bool, &PipelineConfig)
获取当前配置状态
Sourcepub fn get_logger(&self) -> &Logger
pub fn get_logger(&self) -> &Logger
获取Logger引用
Auto Trait Implementations§
impl Freeze for ImageManager
impl RefUnwindSafe for ImageManager
impl Send for ImageManager
impl Sync for ImageManager
impl Unpin for ImageManager
impl UnwindSafe for ImageManager
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
Mutably borrows from an owned value. Read more