pub struct CacheConfig {
pub local_path: PathBuf,
pub server_endpoint: String,
pub timeout_secs: Option<u64>,
pub shared_storage: bool,
pub transfer_chunk_size: usize,
}Expand description
Configuration for model cache management
Fields§
§local_path: PathBufLocal path where models are cached
server_endpoint: StringServer endpoint for model downloads
timeout_secs: Option<u64>Timeout for cache operations
Whether to use shared storage mode (client and server share a network drive) When false, files will be streamed from server to client
transfer_chunk_size: usizeChunk size in bytes for file transfer streaming when shared_storage is false
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn new(local_path: PathBuf, server_endpoint: Option<String>) -> Result<Self>
pub fn new(local_path: PathBuf, server_endpoint: Option<String>) -> Result<Self>
Create a cache configuration with explicit parameters
Sourcepub fn from_config_file() -> Result<Self>
pub fn from_config_file() -> Result<Self>
Load configuration from file
Sourcepub fn save_to_config_file(&self) -> Result<()>
pub fn save_to_config_file(&self) -> Result<()>
Save configuration to file
Sourcepub fn auto_detect() -> Result<Self>
pub fn auto_detect() -> Result<Self>
Auto-detect cache configuration
Sourcepub fn from_server() -> Result<Self>
pub fn from_server() -> Result<Self>
Query server for cache information
Sourcepub fn folder_name_to_model_id(folder_name: &str) -> String
pub fn folder_name_to_model_id(folder_name: &str) -> String
Convert a Hugging Face folder name back to the original model ID Examples:
- “models–google-t5–t5-small” -> “google-t5/t5-small”
Sourcepub fn get_cache_stats(&self) -> Result<CacheStats>
pub fn get_cache_stats(&self) -> Result<CacheStats>
Get cache statistics
Sourcepub fn clear_model(&self, model_name: &str) -> Result<()>
pub fn clear_model(&self, model_name: &str) -> Result<()>
Clear specific model from cache
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnwindSafe for CacheConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request