Struct Repository

Source
pub struct Repository {
    pub id: RepoId,
    pub backend: Repository,
}
Expand description

Git implementation of WriteRepository using the git2 crate.

Fields§

§id: RepoId

The repository identifier (RID).

§backend: Repository

The backing Git repository.

Implementations§

Source§

impl Repository

Source

pub fn open<P>(path: P, id: RepoId) -> Result<Repository, RepositoryError>
where P: AsRef<Path>,

Open an existing repository.

Source

pub fn create<P>( path: P, id: RepoId, info: &UserInfo, ) -> Result<Repository, Error>
where P: AsRef<Path>,

Create a new repository.

Source

pub fn remove(&self) -> Result<(), Error>

Remove an existing repository

Source

pub fn clean( &self, local: &PublicKey, ) -> Result<Vec<PublicKey>, RepositoryError>

Remove all the remotes of a repository that are not the delegates of the repository or the local peer.

N.b. failure to delete remotes or references will not result in an early exit. Instead, this method continues to delete the next available remote or reference.

Source

pub fn init<G, S>( doc: &Doc, storage: &S, signer: &Device<G>, ) -> Result<(Repository, Oid), RepositoryError>

Create the repository’s identity branch.

Source

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

Source

pub fn references( &self, ) -> Result<impl Iterator<Item = Result<Ref, Error>>, Error>

Iterate over all references.

Source

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

Get the canonical project information.

Source

pub fn identity_doc_of(&self, remote: &PublicKey) -> Result<Doc, DocError>

Source

pub fn remote_ids( &self, ) -> Result<impl Iterator<Item = Result<PublicKey, Error>>, Error>

Source

pub fn remotes( &self, ) -> Result<impl Iterator<Item = Result<(PublicKey, Remote), Error>>, Error>

Trait Implementations§

Source§

impl ReadRepository for Repository

Source§

fn id(&self) -> RepoId

Return the repository id.
Source§

fn is_empty(&self) -> Result<bool, Error>

Returns true if there are no references in the repository.
Source§

fn path(&self) -> &Path

The Path to the git repository.
Source§

fn blob_at<P>(&self, commit: Oid, path: P) -> Result<Blob<'_>, Error>
where P: AsRef<Path>,

Get a blob in this repository at the given commit and path.
Source§

fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>

Get a blob in this repository, given its id.
Source§

fn reference( &self, remote: &PublicKey, name: &Qualified<'_>, ) -> Result<Reference<'_>, Error>

Get the reference for the given remote. Read more
Source§

fn reference_oid( &self, remote: &PublicKey, reference: &Qualified<'_>, ) -> Result<Oid, Error>

Get the object id of a reference under the given remote.
Source§

fn commit(&self, oid: Oid) -> Result<Commit<'_>, Error>

Get the git2::Commit found using its oid. Read more
Source§

fn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>

Perform a revision walk of a commit history starting from the given head.
Source§

fn contains(&self, oid: Oid) -> Result<bool, Error>

Check if the underlying ODB contains the given oid.
Source§

fn is_ancestor_of(&self, ancestor: Oid, head: Oid) -> Result<bool, Error>

Check whether the given commit is an ancestor of another commit.
Source§

fn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>

Get all references of the given remote.
Source§

fn references_glob( &self, pattern: &PatternStr, ) -> Result<Vec<(Qualified<'_>, Oid)>, Error>

Get all references following a pattern. Skips references with names that are not parseable into Qualified. Read more
Source§

fn identity_doc_at(&self, head: Oid) -> Result<DocAt, DocError>

Get the repository’s identity document at a specific commit.
Source§

fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>

Get the head of this repository. Read more
Source§

fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>

Compute the canonical head of this repository. Read more
Source§

fn identity_head(&self) -> Result<Oid, RepositoryError>

Get the head of the rad/id reference in this repository. Read more
Source§

fn identity_head_of(&self, remote: &PublicKey) -> Result<Oid, Error>

Get the identity head of a specific remote.
Source§

fn identity_root(&self) -> Result<Oid, RepositoryError>

Get the root commit of the canonical identity branch.
Source§

fn identity_root_of(&self, remote: &PublicKey) -> Result<Oid, RepositoryError>

Get the root commit of the identity branch of a sepcific remote.
Source§

fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>

Compute the canonical rad/id of this repository. Read more
Source§

fn merge_base(&self, left: &Oid, right: &Oid) -> Result<Oid, Error>

Get the merge base of two commits.
Source§

fn identity(&self) -> Result<Identity, RepositoryError>
where Self: Store,

Load the identity history.
Source§

fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>

Compute the canonical identity document.
Source§

fn delegates(&self) -> Result<NonEmpty<Did>, RepositoryError>

Get repository delegates.
Source§

fn identity_doc(&self) -> Result<DocAt, RepositoryError>

Get the repository’s identity document.
Source§

impl RemoteRepository for Repository

Source§

fn remotes(&self) -> Result<Remotes<Verified>, Error>

Get all remotes.
Source§

fn remote(&self, remote: &PublicKey) -> Result<Remote, Error>

Get the given remote.
Source§

fn remote_refs_at(&self) -> Result<Vec<RefsAt>, Error>

Get RefsAt of all remotes.
Source§

impl SignRepository for Repository

Source§

fn sign_refs<G>( &self, signer: &Device<G>, ) -> Result<SignedRefs<Verified>, RepositoryError>
where G: Signer<Signature>,

Sign the repository’s refs under the refs/rad/sigrefs branch.
Source§

impl Storage for Repository

Source§

type StoreError = <Repository as Storage>::StoreError

Source§

type LoadError = <Repository as Storage>::LoadError

Source§

type ObjectId = <Repository as Storage>::ObjectId

Source§

type Parent = <Repository as Storage>::Parent

Source§

type Signatures = <Repository as Storage>::Signatures

Source§

fn store<Signer>( &self, authority: Option<<Repository as Storage>::Parent>, parents: Vec<<Repository as Storage>::Parent>, signer: &Signer, spec: Template<<Repository as Storage>::ObjectId>, ) -> Result<Entry<Oid, Oid, ExtendedSignature>, <Repository as Storage>::StoreError>
where Signer: Signer<ExtendedSignature>,

Store a new change entry.
Source§

fn load( &self, id: <Repository as Storage>::ObjectId, ) -> Result<Entry<Oid, Oid, ExtendedSignature>, <Repository as Storage>::LoadError>

Load a change entry.
Source§

fn parents_of( &self, id: &Oid, ) -> Result<Vec<Oid>, <Repository as Storage>::LoadError>

Returns the parents of the object with the specified ID.
Source§

impl Storage for Repository

Source§

type ObjectsError = ObjectsError

Source§

type TypesError = TypesError

Source§

type UpdateError = Error

Source§

type RemoveError = Error

Source§

type Namespace = PublicKey

Source§

fn objects( &self, typename: &TypeName, object_id: &ObjectId, ) -> Result<Objects, <Repository as Storage>::ObjectsError>

Get all references which point to a head of the change graph for a particular object
Source§

fn types( &self, typename: &TypeName, ) -> Result<BTreeMap<ObjectId, Objects>, <Repository as Storage>::TypesError>

Get all references to objects of a given type within a particular identity
Source§

fn update( &self, namespace: &<Repository as Storage>::Namespace, typename: &TypeName, object_id: &ObjectId, entry: &Oid, ) -> Result<(), <Repository as Storage>::UpdateError>

Update a ref to a particular collaborative object
Source§

fn remove( &self, namespace: &<Repository as Storage>::Namespace, typename: &TypeName, object_id: &ObjectId, ) -> Result<(), <Repository as Storage>::RemoveError>

Remove a ref to a particular collaborative object
Source§

impl ValidateRepository for Repository

Source§

fn validate_remote(&self, remote: &Remote) -> Result<Validations, Error>

Validates a remote’s signed refs and identity. Read more
Source§

fn validate(&self) -> Result<Validations, Error>

Validate all remotes with ValidateRepository::validate_remote.
Source§

impl WriteRepository for Repository

Source§

fn set_head(&self) -> Result<SetHead, RepositoryError>

Set the repository head to the canonical branch. This computes the head based on the delegate set.
Source§

fn set_identity_head_to(&self, commit: Oid) -> Result<(), RepositoryError>

Set the repository ‘rad/id’ to the given commit.
Source§

fn set_remote_identity_root_to( &self, remote: &PublicKey, root: Oid, ) -> Result<(), RepositoryError>

Set the identity root reference to the given commit.
Source§

fn set_user(&self, info: &UserInfo) -> Result<(), Error>

Set the user info of the Git repository.
Source§

fn raw(&self) -> &Repository

Get the underlying git repository.
Source§

fn set_identity_head(&self) -> Result<Oid, RepositoryError>

Set the repository ‘rad/id’ to the canonical commit, agreed by quorum.
Source§

fn set_remote_identity_root( &self, remote: &PublicKey, ) -> Result<Oid, RepositoryError>

Set the identity root reference to the canonical identity root commit.
Source§

impl Store for Repository

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> HasRepoId for T
where T: ReadRepository,

Source§

fn rid(&self) -> RepoId

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> IntoInit<ZeroInit> for 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,