pub struct LocalCatalog { /* private fields */ }Expand description
A ManagedCatalog type to mediate and aggregate the contents of one or more “upstream” catalogs
§Division of responsibilities with upstream catalogs
LocalCatalog:
- Tracks which modules are installed on-disk
- Manages the on-disk location of the downloaded / cached modules
- TODO-Future: will track requirements and module dependency trees
upstream Catalogs:
- Track which modules are available from the outside world
- Track the remote location of each module and any parameters needed to access it
Implementations§
Source§impl LocalCatalog
impl LocalCatalog
pub fn new(caches_dir: &Path, name: &str) -> Result<Self, String>
pub fn push_upstream_catalog(&mut self, catalog: Box<dyn ModuleCatalog>)
pub fn upstream_catalogs(&self) -> &[Box<dyn ModuleCatalog>]
Trait Implementations§
Source§impl Debug for LocalCatalog
impl Debug for LocalCatalog
Source§impl ManagedCatalog for LocalCatalog
impl ManagedCatalog for LocalCatalog
Source§fn clear_all(&self) -> Result<(), String>
fn clear_all(&self) -> Result<(), String>
Clears all locally stored modules, resetting the local catalog to an empty state
Source§fn fetch(
&self,
descriptor: &ModuleDescriptor,
update_mode: UpdateMode,
) -> Result<(), String>
fn fetch( &self, descriptor: &ModuleDescriptor, update_mode: UpdateMode, ) -> Result<(), String>
Fetch a specific module from the UpstreamCatalog. Returns `Ok(())`` if the module
already exists in the catalog Read more
Source§fn remove(&self, descriptor: &ModuleDescriptor) -> Result<(), String>
fn remove(&self, descriptor: &ModuleDescriptor) -> Result<(), String>
Remove a specific module from the catalog
Source§fn fetch_newest_for_all(&self, update_mode: UpdateMode) -> Result<(), String>
fn fetch_newest_for_all(&self, update_mode: UpdateMode) -> Result<(), String>
AKA “upgrade”. Fetches the newest version for each module that currently exists in
the catalog Read more
Source§impl ModuleCatalog for LocalCatalog
impl ModuleCatalog for LocalCatalog
Source§fn display_name(&self) -> String
fn display_name(&self) -> String
The name of the catalog, to be displayed to the user
Source§fn lookup(&self, name: &str) -> Vec<ModuleDescriptor>
fn lookup(&self, name: &str) -> Vec<ModuleDescriptor>
Returns the ModuleDescriptor for every module in the
ModuleCatalog with the specified nameSource§fn get_loader(
&self,
descriptor: &ModuleDescriptor,
) -> Result<Box<dyn ModuleLoader>, String>
fn get_loader( &self, descriptor: &ModuleDescriptor, ) -> Result<Box<dyn ModuleLoader>, String>
Returns a ModuleLoader for the specified module from the
ModuleCatalogSource§fn list<'a>(&'a self) -> Option<Box<dyn Iterator<Item = ModuleDescriptor> + 'a>>
fn list<'a>(&'a self) -> Option<Box<dyn Iterator<Item = ModuleDescriptor> + 'a>>
Returns an iterator over every module available in the catalog. May not be supported
by all catalog implementations
Source§fn sync_toc(&self, update_mode: UpdateMode) -> Result<(), String>
fn sync_toc(&self, update_mode: UpdateMode) -> Result<(), String>
Synchronize the catalog’s internal tables, so fresh upstream info is reflected
locally. Does not fetch any modules
Source§fn as_managed(&self) -> Option<&dyn ManagedCatalog>
fn as_managed(&self) -> Option<&dyn ManagedCatalog>
Returns the catalog as a ManagedCatalog if the catalog supports active management
Source§fn lookup_with_uid(&self, name: &str, uid: Option<u64>) -> Vec<ModuleDescriptor>
fn lookup_with_uid(&self, name: &str, uid: Option<u64>) -> Vec<ModuleDescriptor>
Returns the ModuleDescriptor for every module in the
ModuleCatalog with the specified name,
and uid matchSource§fn lookup_with_version_req(
&self,
name: &str,
version_req: Option<&VersionReq>,
) -> Vec<ModuleDescriptor>
fn lookup_with_version_req( &self, name: &str, version_req: Option<&VersionReq>, ) -> Vec<ModuleDescriptor>
Returns the ModuleDescriptor for every module in the
ModuleCatalog with the specified name
matching the version requirements Read moreSource§fn lookup_newest_with_version_req(
&self,
name: &str,
version_req: Option<&VersionReq>,
) -> Option<ModuleDescriptor>
fn lookup_newest_with_version_req( &self, name: &str, version_req: Option<&VersionReq>, ) -> Option<ModuleDescriptor>
Returns the ModuleDescriptor for the newest module in the
ModuleCatalog, that matches the
specified version requirement, or None if no module exists Read moreSource§fn lookup_newest_with_uid_and_version_req(
&self,
name: &str,
uid: Option<u64>,
version_req: Option<&VersionReq>,
) -> Option<ModuleDescriptor>
fn lookup_newest_with_uid_and_version_req( &self, name: &str, uid: Option<u64>, version_req: Option<&VersionReq>, ) -> Option<ModuleDescriptor>
Returns the ModuleDescriptor for the newest module in the
ModuleCatalog, that matches the
specified name, uid, and version requirement, or None if no module exists Read moreSource§fn list_names<'a>(&'a self) -> Option<Box<dyn Iterator<Item = String> + 'a>>
fn list_names<'a>(&'a self) -> Option<Box<dyn Iterator<Item = String> + 'a>>
Returns an iterator over every unique module name in the catalog. May not be supported
by all catalog implementations
Auto Trait Implementations§
impl !Freeze for LocalCatalog
impl !RefUnwindSafe for LocalCatalog
impl Send for LocalCatalog
impl Sync for LocalCatalog
impl Unpin for LocalCatalog
impl !UnwindSafe for LocalCatalog
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
§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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request