Skip to main content

AliasManager

Struct AliasManager 

Source
pub struct AliasManager { /* private fields */ }
Expand description

Manages human-readable aliases for sequences and collections.

Implementations§

Source§

impl AliasManager

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn add_sequence( &mut self, namespace: &str, alias: &str, digest: &str, force: bool, ) -> Result<()>

Bind a sequence alias. Errors if it already points to a different digest, unless force.

Source

pub fn resolve_sequence(&self, namespace: &str, alias: &str) -> Option<[u8; 48]>

Source

pub fn reverse_lookup_sequence(&self, digest: &str) -> Vec<(String, String)>

Source

pub fn sequence_namespaces(&self) -> Vec<String>

Source

pub fn sequence_aliases(&self, namespace: &str) -> Option<Vec<String>>

Source

pub fn remove_sequence(&mut self, namespace: &str, alias: &str) -> bool

Source

pub fn load_sequence_tsv( &mut self, namespace: &str, path: &Path, force: bool, ) -> Result<Vec<String>>

Load a TSV of sequence aliases, all or nothing, returning the distinct alias names bound. See [alias_load_tsv] for what is refused.

Source

pub fn add_collection( &mut self, namespace: &str, alias: &str, digest: &str, force: bool, ) -> Result<()>

Bind a collection alias. Errors if it already points to a different digest, unless force.

Source

pub fn resolve_collection( &self, namespace: &str, alias: &str, ) -> Option<[u8; 48]>

Source

pub fn reverse_lookup_collection(&self, digest: &str) -> Vec<(String, String)>

Source

pub fn collection_namespaces(&self) -> Vec<String>

Source

pub fn collection_aliases(&self, namespace: &str) -> Option<Vec<String>>

Source

pub fn remove_collection(&mut self, namespace: &str, alias: &str) -> bool

Source

pub fn load_collection_tsv( &mut self, namespace: &str, path: &Path, force: bool, ) -> Result<Vec<String>>

Load a TSV of collection aliases, all or nothing, returning the distinct alias names bound. See [alias_load_tsv] for what is refused.

Source

pub fn load_from_dir(&mut self, aliases_dir: &Path) -> Result<()>

Source

pub fn load_namespaces_from_dir( &mut self, aliases_dir: &Path, sequence_namespaces: &[String], collection_namespaces: &[String], ) -> Result<()>

Load only the alias namespaces explicitly listed (the manifest-driven path). Unlike load_from_dir, which scans the directory for any *.tsv present, this loads exactly <aliases_dir>/{sequences,collections}/<ns>.tsv for each listed namespace. This makes rgstore.json the single source of truth for what a store advertises: an alias file on disk that the manifest does not list is simply not loaded, so a stale manifest fails identically on a local filesystem and over HTTP (where directory listing is impossible).

Source

pub fn write_to_dir(&self, aliases_dir: &Path) -> Result<()>

Trait Implementations§

Source§

impl Debug for AliasManager

Source§

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

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

impl Default for AliasManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.