LocalCatalog

Struct LocalCatalog 

Source
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

Source

pub fn new(caches_dir: &Path, name: &str) -> Result<Self, String>

Source

pub fn push_upstream_catalog(&mut self, catalog: Box<dyn ModuleCatalog>)

Source

pub fn upstream_catalogs(&self) -> &[Box<dyn ModuleCatalog>]

Trait Implementations§

Source§

impl Debug for LocalCatalog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ManagedCatalog for LocalCatalog

Source§

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>

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>

Remove a specific module from the catalog
Source§

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

Source§

fn display_name(&self) -> String

The name of the catalog, to be displayed to the user
Source§

fn lookup(&self, name: &str) -> Vec<ModuleDescriptor>

Returns the ModuleDescriptor for every module in the ModuleCatalog with the specified name
Source§

fn get_loader( &self, descriptor: &ModuleDescriptor, ) -> Result<Box<dyn ModuleLoader>, String>

Returns a ModuleLoader for the specified module from the ModuleCatalog
Source§

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>

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>

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>

Returns the ModuleDescriptor for every module in the ModuleCatalog with the specified name, and uid match
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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
Source§

fn list_name_uid_pairs<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = (String, Option<u64>)> + 'a>>

Returns an iterator over every unique (module name, uid) pair in the catalog. May not be supported by all catalog implementations
Source§

fn as_any(&self) -> Option<&dyn Any>

Returns the catalog as an Any in order to get back to the underlying object

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> RefOrMove<T> for T

§

fn as_value(self) -> T

§

fn as_ref(&self) -> &T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more