pub struct ToolRegistryPersistence { /* private fields */ }Expand description
Tool registry persistence manager
This struct manages the persistence of tool registries using storage backends.
Implementations§
Source§impl ToolRegistryPersistence
impl ToolRegistryPersistence
Sourcepub fn new(
storage: Arc<dyn ToolRegistryStorage>,
registry_path: PathBuf,
tools_dir: PathBuf,
) -> Self
pub fn new( storage: Arc<dyn ToolRegistryStorage>, registry_path: PathBuf, tools_dir: PathBuf, ) -> Self
Creates a new tool registry persistence manager
§Arguments
storage- The storage backend to useregistry_path- The path where the registry file is storedtools_dir- The directory where individual tool files are stored
Sourcepub fn save_registry(&self, registry: &ToolRegistry) -> Result<()>
pub fn save_registry(&self, registry: &ToolRegistry) -> Result<()>
Saves a tool registry to persistent storage
Sourcepub fn load_registry(&self) -> Result<ToolRegistry>
pub fn load_registry(&self) -> Result<ToolRegistry>
Loads a tool registry from persistent storage
Sourcepub fn save_tool(&self, tool: &ToolMetadata) -> Result<()>
pub fn save_tool(&self, tool: &ToolMetadata) -> Result<()>
Saves a single tool to persistent storage
Sourcepub fn load_tool(&self, tool_id: &str) -> Result<ToolMetadata>
pub fn load_tool(&self, tool_id: &str) -> Result<ToolMetadata>
Loads a single tool from persistent storage
Sourcepub fn list_tools(&self) -> Result<Vec<ToolMetadata>>
pub fn list_tools(&self) -> Result<Vec<ToolMetadata>>
Lists all tools in persistent storage
Sourcepub fn export_registry(
&self,
registry: &ToolRegistry,
path: &Path,
format: &str,
) -> Result<()>
pub fn export_registry( &self, registry: &ToolRegistry, path: &Path, format: &str, ) -> Result<()>
Exports a registry to a specific format
Sourcepub fn import_registry(&self, path: &Path, format: &str) -> Result<ToolRegistry>
pub fn import_registry(&self, path: &Path, format: &str) -> Result<ToolRegistry>
Imports a registry from a specific format
Auto Trait Implementations§
impl Freeze for ToolRegistryPersistence
impl !RefUnwindSafe for ToolRegistryPersistence
impl Send for ToolRegistryPersistence
impl Sync for ToolRegistryPersistence
impl Unpin for ToolRegistryPersistence
impl !UnwindSafe for ToolRegistryPersistence
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