pub struct Storage { /* private fields */ }
Implementations§
source§impl Storage
impl Storage
sourcepub fn open<P: AsRef<Path>>(path: P, info: UserInfo) -> Result<Self, Error>
pub fn open<P: AsRef<Path>>(path: P, info: UserInfo) -> Result<Self, Error>
Open a new storage instance and load its inventory.
sourcepub fn lock_repository(
&self,
rid: RepoId,
) -> Result<(Repository, TempDir), RepositoryError>
pub fn lock_repository( &self, rid: RepoId, ) -> Result<(Repository, TempDir), RepositoryError>
Create a Repository
in a temporary directory.
N.b. it is important to keep the TempDir
in scope while
using the Repository
. If it is dropped, any action on the
Repository
will fail.
pub fn path(&self) -> &Path
pub fn repositories_by_id<'a>( &self, rids: impl Iterator<Item = &'a RepoId>, ) -> Result<Vec<RepositoryInfo<Verified>>, RepositoryError>
pub fn inspect(&self) -> Result<(), RepositoryError>
Trait Implementations§
source§impl ReadStorage for Storage
impl ReadStorage for Storage
type Repository = Repository
type InventoryRef<'a> = InventoryLock<'a>
source§fn contains(&self, rid: &RepoId) -> Result<bool, RepositoryError>
fn contains(&self, rid: &RepoId) -> Result<bool, RepositoryError>
Check whether storage contains a repository.
source§fn inventory_ref<'a, 's: 'a>(&'s self) -> InventoryLock<'a>
fn inventory_ref<'a, 's: 'a>(&'s self) -> InventoryLock<'a>
Return a reference to the inventory. Note that this function may hold a
lock to the inventory.
source§fn inventory(&self) -> Result<Inventory, Error>
fn inventory(&self) -> Result<Inventory, Error>
Get the inventory of repositories hosted under this storage.
This function should typically only return public repositories.
source§fn repository(&self, rid: RepoId) -> Result<Self::Repository, RepositoryError>
fn repository(&self, rid: RepoId) -> Result<Self::Repository, RepositoryError>
Open or create a read-only repository.
source§fn repositories(&self) -> Result<Vec<RepositoryInfo<Verified>>, Error>
fn repositories(&self) -> Result<Vec<RepositoryInfo<Verified>>, Error>
Return all repositories (public and private).
source§impl WriteStorage for Storage
impl WriteStorage for Storage
type RepositoryMut = Repository
source§fn repository_mut(
&self,
rid: RepoId,
) -> Result<Self::RepositoryMut, RepositoryError>
fn repository_mut( &self, rid: RepoId, ) -> Result<Self::RepositoryMut, RepositoryError>
Open a read-write repository.
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
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