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§
Sourcefn is_empty(&self) -> Result<bool, Error>
fn is_empty(&self) -> Result<bool, Error>
Returns true
if there are no references in the repository.
Sourcefn blob_at<P>(&self, commit: Oid, path: P) -> Result<Blob<'_>, Error>
fn blob_at<P>(&self, commit: Oid, path: P) -> Result<Blob<'_>, Error>
Get a blob in this repository at the given commit and path.
Sourcefn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>
fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>
Get a blob in this repository, given its id.
Sourcefn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
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.
Sourcefn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
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.
Sourcefn identity_head(&self) -> Result<Oid, RepositoryError>
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
.
Sourcefn identity_head_of(&self, remote: &PublicKey) -> Result<Oid, Error>
fn identity_head_of(&self, remote: &PublicKey) -> Result<Oid, Error>
Get the identity head of a specific remote.
Sourcefn identity_root(&self) -> Result<Oid, RepositoryError>
fn identity_root(&self) -> Result<Oid, RepositoryError>
Get the root commit of the canonical identity branch.
Sourcefn identity_root_of(&self, remote: &PublicKey) -> Result<Oid, RepositoryError>
fn identity_root_of(&self, remote: &PublicKey) -> Result<Oid, RepositoryError>
Get the root commit of the identity branch of a sepcific remote.
Sourcefn canonical_identity_head(&self) -> Result<Oid, RepositoryError>
fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>
Compute the canonical rad/id
of this repository.
Ignores any existing rad/id
reference.
Sourcefn reference(
&self,
remote: &PublicKey,
reference: &Qualified<'_>,
) -> Result<Reference<'_>, Error>
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.
Sourcefn commit(&self, oid: Oid) -> Result<Commit<'_>, Error>
fn commit(&self, oid: Oid) -> Result<Commit<'_>, Error>
Get the git2::Commit
found using its oid
.
Returns Err
if the commit did not exist.
Sourcefn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>
fn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>
Perform a revision walk of a commit history starting from the given head.
Sourcefn contains(&self, oid: Oid) -> Result<bool, Error>
fn contains(&self, oid: Oid) -> Result<bool, Error>
Check if the underlying ODB contains the given oid
.
Sourcefn is_ancestor_of(&self, ancestor: Oid, head: Oid) -> Result<bool, Error>
fn is_ancestor_of(&self, ancestor: Oid, head: Oid) -> Result<bool, Error>
Check whether the given commit is an ancestor of another commit.
Sourcefn reference_oid(
&self,
remote: &PublicKey,
reference: &Qualified<'_>,
) -> Result<Oid, Error>
fn reference_oid( &self, remote: &PublicKey, reference: &Qualified<'_>, ) -> Result<Oid, Error>
Get the object id of a reference under the given remote.
Sourcefn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>
fn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>
Get all references of the given remote.
Sourcefn references_glob(
&self,
pattern: &PatternStr,
) -> Result<Vec<(Qualified<'_>, Oid)>, Error>
fn references_glob( &self, pattern: &PatternStr, ) -> Result<Vec<(Qualified<'_>, Oid)>, Error>
Provided Methods§
Sourcefn identity(&self) -> Result<Identity, RepositoryError>where
Self: Store,
fn identity(&self) -> Result<Identity, RepositoryError>where
Self: Store,
Load the identity history.
Sourcefn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
Compute the canonical identity document.
Sourcefn identity_doc(&self) -> Result<DocAt, RepositoryError>
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.