Struct radicle::storage::git::Storage

source ·
pub struct Storage { /* private fields */ }

Implementations§

source§

impl Storage

source

pub fn open<P: AsRef<Path>>(path: P, info: UserInfo) -> Result<Self, Error>

Open a new storage instance and load its inventory.

source

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.

source

pub fn path(&self) -> &Path

source

pub fn repositories_by_id<'a>( &self, rids: impl Iterator<Item = &'a RepoId>, ) -> Result<Vec<RepositoryInfo<Verified>>, RepositoryError>

source

pub fn inspect(&self) -> Result<(), RepositoryError>

Trait Implementations§

source§

impl Clone for Storage

source§

fn clone(&self) -> Storage

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Storage

source§

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

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

impl ReadStorage for Storage

§

type Repository = Repository

§

type InventoryRef<'a> = InventoryLock<'a>

source§

fn info(&self) -> &UserInfo

Get user info for this storage.
source§

fn path(&self) -> &Path

Get the storage base path.
source§

fn path_of(&self, rid: &RepoId) -> PathBuf

Get a repository’s path.
source§

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>

Return a reference to the inventory. Note that this function may hold a lock to the inventory.
source§

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 insert(&self, rid: RepoId)

Insert this repository into the inventory.
source§

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>

Return all repositories (public and private).
source§

fn get(&self, rid: RepoId) -> Result<Option<Doc<Verified>>, RepositoryError>

Get a repository’s identity if it exists.
source§

impl WriteStorage for Storage

§

type RepositoryMut = Repository

source§

fn repository_mut( &self, rid: RepoId, ) -> Result<Self::RepositoryMut, RepositoryError>

Open a read-write repository.
source§

fn create(&self, rid: RepoId) -> Result<Self::RepositoryMut, Error>

Create a read-write repository.
source§

fn clean(&self, rid: RepoId) -> Result<Vec<RemoteId>, RepositoryError>

Clean the repository found at rid. 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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.