pub struct AdapterManager {
pub adapters_dir: PathBuf,
/* private fields */
}Expand description
Manages LoRA adapters within a model’s git repository
Fields§
§adapters_dir: PathBufImplementations§
Source§impl AdapterManager
impl AdapterManager
Sourcepub fn new(model_path: impl AsRef<Path>) -> Self
pub fn new(model_path: impl AsRef<Path>) -> Self
Create a new adapter manager for a model (direct filesystem access)
Sourcepub fn with_fs(fs: WorktreeClient) -> Self
pub fn with_fs(fs: WorktreeClient) -> Self
Create a new adapter manager with WorktreeClient for worktree-scoped access
Sourcepub fn ensure_adapters_dir(&self) -> Result<()>
pub fn ensure_adapters_dir(&self) -> Result<()>
Ensure the adapters directory exists
Sourcepub fn list_adapters(&self) -> Result<Vec<AdapterInfo>>
pub fn list_adapters(&self) -> Result<Vec<AdapterInfo>>
List all adapters in the model, sorted by index
Sourcepub fn get_next_index(&self) -> Result<u32>
pub fn get_next_index(&self) -> Result<u32>
Get the next available index for a new adapter
Sourcepub fn create_indexed_name(
&self,
name: &str,
index: Option<u32>,
) -> Result<String>
pub fn create_indexed_name( &self, name: &str, index: Option<u32>, ) -> Result<String>
Create an indexed adapter filename
Sourcepub fn initialize_adapter(
&self,
name: &str,
index: Option<u32>,
config: AdapterConfig,
) -> Result<PathBuf>
pub fn initialize_adapter( &self, name: &str, index: Option<u32>, config: AdapterConfig, ) -> Result<PathBuf>
Initialize adapter with proper implementation
Sourcepub fn get_adapter_paths(&self) -> Result<Vec<PathBuf>>
pub fn get_adapter_paths(&self) -> Result<Vec<PathBuf>>
Load all adapter paths sorted by index
Sourcepub fn load_adapter_config(&self, adapter_name: &str) -> Result<AdapterConfig>
pub fn load_adapter_config(&self, adapter_name: &str) -> Result<AdapterConfig>
Load configuration for a specific adapter
Sourcepub fn has_adapters(&self) -> bool
pub fn has_adapters(&self) -> bool
Check if any adapters exist for this model
Sourcepub fn get_total_size(&self) -> Result<u64>
pub fn get_total_size(&self) -> Result<u64>
Get total size of all adapters
Sourcepub fn remove_adapter(&self, identifier: &str) -> Result<()>
pub fn remove_adapter(&self, identifier: &str) -> Result<()>
Remove an adapter by name or index
Sourcepub async fn ensure_adapters_dir_async(&self) -> Result<()>
pub async fn ensure_adapters_dir_async(&self) -> Result<()>
Ensure the adapters directory exists (async, via FsOps)
Sourcepub async fn list_adapters_async(&self) -> Result<Vec<AdapterInfo>>
pub async fn list_adapters_async(&self) -> Result<Vec<AdapterInfo>>
List all adapters via FsOps, sorted by index
Sourcepub async fn get_next_index_async(&self) -> Result<u32>
pub async fn get_next_index_async(&self) -> Result<u32>
Get the next available index (async, via FsOps)
Sourcepub async fn create_indexed_name_async(
&self,
name: &str,
index: Option<u32>,
) -> Result<String>
pub async fn create_indexed_name_async( &self, name: &str, index: Option<u32>, ) -> Result<String>
Create an indexed adapter filename (async, via FsOps)
Sourcepub async fn initialize_adapter_async(
&self,
name: &str,
index: Option<u32>,
config: AdapterConfig,
) -> Result<String>
pub async fn initialize_adapter_async( &self, name: &str, index: Option<u32>, config: AdapterConfig, ) -> Result<String>
Initialize adapter via FsOps (async)
Returns the relative path within the worktree (e.g., “adapters/00_base.safetensors”).
Sourcepub async fn load_adapter_config_async(
&self,
adapter_name: &str,
) -> Result<AdapterConfig>
pub async fn load_adapter_config_async( &self, adapter_name: &str, ) -> Result<AdapterConfig>
Load configuration for a specific adapter (async, via FsOps)
Sourcepub async fn has_adapters_async(&self) -> Result<bool>
pub async fn has_adapters_async(&self) -> Result<bool>
Check if any adapters exist (async, via FsOps)
Sourcepub async fn remove_adapter_async(&self, identifier: &str) -> Result<()>
pub async fn remove_adapter_async(&self, identifier: &str) -> Result<()>
Remove an adapter by name or index (async, via FsOps)
Sourcepub async fn write_config_async(
&self,
adapter_name: &str,
config: &AdapterConfig,
) -> Result<()>
pub async fn write_config_async( &self, adapter_name: &str, config: &AdapterConfig, ) -> Result<()>
Write adapter config file (async, via FsOps)
Auto Trait Implementations§
impl Freeze for AdapterManager
impl !RefUnwindSafe for AdapterManager
impl Send for AdapterManager
impl Sync for AdapterManager
impl Unpin for AdapterManager
impl UnsafeUnpin for AdapterManager
impl !UnwindSafe for AdapterManager
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§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>
T in a tonic::Request