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
impl Repository
Sourcepub fn open<P>(path: P, id: RepoId) -> Result<Repository, RepositoryError>
pub fn open<P>(path: P, id: RepoId) -> Result<Repository, RepositoryError>
Open an existing repository.
Sourcepub fn create<P>(
path: P,
id: RepoId,
info: &UserInfo,
) -> Result<Repository, Error>
pub fn create<P>( path: P, id: RepoId, info: &UserInfo, ) -> Result<Repository, Error>
Create a new repository.
Sourcepub fn clean(
&self,
local: &PublicKey,
) -> Result<Vec<PublicKey>, RepositoryError>
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.
Sourcepub fn init<G, S>(
doc: &Doc,
storage: &S,
signer: &Device<G>,
) -> Result<(Repository, Oid), RepositoryError>
pub fn init<G, S>( doc: &Doc, storage: &S, signer: &Device<G>, ) -> Result<(Repository, Oid), RepositoryError>
Create the repository’s identity branch.
pub fn inspect(&self) -> Result<(), Error>
Sourcepub fn references(
&self,
) -> Result<impl Iterator<Item = Result<Ref, Error>>, Error>
pub fn references( &self, ) -> Result<impl Iterator<Item = Result<Ref, Error>>, Error>
Iterate over all references.
Sourcepub fn project(&self) -> Result<Project, RepositoryError>
pub fn project(&self) -> Result<Project, RepositoryError>
Get the canonical project information.
pub fn identity_doc_of(&self, remote: &PublicKey) -> Result<Doc, DocError>
pub fn remote_ids( &self, ) -> Result<impl Iterator<Item = Result<PublicKey, Error>>, Error>
pub fn remotes( &self, ) -> Result<impl Iterator<Item = Result<(PublicKey, Remote), Error>>, Error>
Trait Implementations§
Source§impl ReadRepository for Repository
impl ReadRepository for Repository
Source§fn is_empty(&self) -> Result<bool, Error>
fn is_empty(&self) -> Result<bool, Error>
Returns
true
if there are no references in the repository.Source§fn 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.
Source§fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>
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>
fn reference( &self, remote: &PublicKey, name: &Qualified<'_>, ) -> Result<Reference<'_>, Error>
Source§fn 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.
Source§fn 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.
Source§fn contains(&self, oid: Oid) -> Result<bool, Error>
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>
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>
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>
fn references_glob( &self, pattern: &PatternStr, ) -> Result<Vec<(Qualified<'_>, Oid)>, Error>
Source§fn identity_doc_at(&self, head: Oid) -> Result<DocAt, DocError>
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>
fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
Get the head of this repository. Read more
Source§fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
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>
fn identity_head(&self) -> Result<Oid, RepositoryError>
Get the head of the
rad/id
reference in this repository. Read moreSource§fn 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.
Source§fn identity_root(&self) -> Result<Oid, RepositoryError>
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>
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>
fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>
Compute the canonical
rad/id
of this repository. Read moreSource§fn merge_base(&self, left: &Oid, right: &Oid) -> Result<Oid, Error>
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,
fn identity(&self) -> Result<Identity, RepositoryError>where
Self: Store,
Load the identity history.
Source§fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
Compute the canonical identity document.
Source§fn identity_doc(&self) -> Result<DocAt, RepositoryError>
fn identity_doc(&self) -> Result<DocAt, RepositoryError>
Get the repository’s identity document.
Source§impl RemoteRepository for Repository
impl RemoteRepository for Repository
Source§impl SignRepository for Repository
impl SignRepository for Repository
Source§fn sign_refs<G>(
&self,
signer: &Device<G>,
) -> Result<SignedRefs<Verified>, RepositoryError>
fn sign_refs<G>( &self, signer: &Device<G>, ) -> Result<SignedRefs<Verified>, RepositoryError>
Sign the repository’s refs under the
refs/rad/sigrefs
branch.Source§impl Storage for Repository
impl Storage for Repository
type StoreError = <Repository as Storage>::StoreError
type LoadError = <Repository as Storage>::LoadError
type ObjectId = <Repository as Storage>::ObjectId
type Parent = <Repository as Storage>::Parent
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>,
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>
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>
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
impl Storage for Repository
type ObjectsError = ObjectsError
type TypesError = TypesError
type UpdateError = Error
type RemoveError = Error
type Namespace = PublicKey
Source§fn objects(
&self,
typename: &TypeName,
object_id: &ObjectId,
) -> Result<Objects, <Repository as Storage>::ObjectsError>
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>
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>
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>
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
impl ValidateRepository for Repository
Source§fn validate_remote(&self, remote: &Remote) -> Result<Validations, Error>
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>
fn validate(&self) -> Result<Validations, Error>
Validate all remotes with
ValidateRepository::validate_remote
.Source§impl WriteRepository for Repository
impl WriteRepository for Repository
Source§fn set_head(&self) -> Result<SetHead, RepositoryError>
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>
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>
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>
fn set_user(&self, info: &UserInfo) -> Result<(), Error>
Set the user info of the Git repository.
Source§fn raw(&self) -> &Repository
fn raw(&self) -> &Repository
Get the underlying git repository.
Source§fn set_identity_head(&self) -> Result<Oid, RepositoryError>
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>
fn set_remote_identity_root( &self, remote: &PublicKey, ) -> Result<Oid, RepositoryError>
Set the identity root reference to the canonical identity root commit.
impl Store for Repository
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl !Sync for Repository
impl Unpin for Repository
impl UnwindSafe for Repository
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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