Trait ReadRepository

Source
pub trait ReadRepository: Sized + ValidateRepository {
Show 26 methods // Required methods fn id(&self) -> RepoId; fn is_empty(&self) -> Result<bool, Error>; fn path(&self) -> &Path; fn blob_at<P>(&self, commit: Oid, path: P) -> Result<Blob<'_>, Error> where P: AsRef<Path>; fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>; fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>; fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>; fn identity_head(&self) -> Result<Oid, RepositoryError>; fn identity_head_of(&self, remote: &PublicKey) -> Result<Oid, Error>; fn identity_root(&self) -> Result<Oid, RepositoryError>; fn identity_root_of( &self, remote: &PublicKey, ) -> Result<Oid, RepositoryError>; fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>; fn reference( &self, remote: &PublicKey, reference: &Qualified<'_>, ) -> Result<Reference<'_>, Error>; fn commit(&self, oid: Oid) -> Result<Commit<'_>, Error>; fn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>; fn contains(&self, oid: Oid) -> Result<bool, Error>; fn is_ancestor_of(&self, ancestor: Oid, head: Oid) -> Result<bool, Error>; fn reference_oid( &self, remote: &PublicKey, reference: &Qualified<'_>, ) -> Result<Oid, Error>; fn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>; fn references_glob( &self, pattern: &PatternStr, ) -> Result<Vec<(Qualified<'_>, Oid)>, Error>; fn identity_doc_at(&self, head: Oid) -> Result<DocAt, DocError>; fn merge_base(&self, left: &Oid, right: &Oid) -> Result<Oid, Error>; // Provided methods fn identity(&self) -> Result<Identity, RepositoryError> where Self: Store { ... } fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError> { ... } fn delegates(&self) -> Result<NonEmpty<Did>, RepositoryError> { ... } fn identity_doc(&self) -> Result<DocAt, RepositoryError> { ... }
}
Expand description

Allows read-only access to a repository.

Required Methods§

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 head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>

Get the head of this repository.

Returns the reference pointed to by HEAD if it is set. Otherwise, computes the canonical head using ReadRepository::canonical_head.

Returns the Oid as well as the qualified reference name.

Source

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

Compute the canonical head of this repository.

Ignores any existing HEAD reference.

Returns the Oid as well as the qualified reference name.

Source

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

Get the head of the rad/id reference in this repository.

Returns the reference pointed to by rad/id if it is set. Otherwise, computes the canonical rad/id using ReadRepository::canonical_identity_head.

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.

Ignores any existing rad/id reference.

Source

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

Get the reference for the given remote.

Returns None is the reference did not exist.

Source

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

Get the git2::Commit found using its oid.

Returns Err if the commit did not exist.

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 reference_oid( &self, remote: &PublicKey, reference: &Qualified<'_>, ) -> Result<Oid, Error>

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

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.

This function always peels reference to the commit. For tags, this means the Oid of the commit pointed to by the tag is returned, and not the Oid of the tag itsself.

Source

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

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

Source

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

Get the merge base of two commits.

Provided Methods§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§