pub struct Repository {
pub id: RepoId,
pub backend: Repository,
}Expand description
Git implementation of WriteRepository using the git2 crate.
Fields§
§id: RepoIdThe repository identifier (RID).
backend: RepositoryThe 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 Ancestry for Repository
impl Ancestry for Repository
Source§fn graph_ahead_behind(
&self,
commit: Oid,
upstream: Oid,
) -> Result<GraphAheadBehind, GraphDescendant>
fn graph_ahead_behind( &self, commit: Oid, upstream: Oid, ) -> Result<GraphAheadBehind, GraphDescendant>
Source§impl AsRef<Repository> for Repository
impl AsRef<Repository> for Repository
Source§fn as_ref(&self) -> &Repository
fn as_ref(&self) -> &Repository
Source§impl AsRef<Repository> for TempRepository
impl AsRef<Repository> for TempRepository
Source§fn as_ref(&self) -> &Repository
fn as_ref(&self) -> &Repository
Source§impl FindMergeBase for Repository
impl FindMergeBase for Repository
Source§fn merge_base(&self, a: Oid, b: Oid) -> Result<MergeBase, MergeBaseError>
fn merge_base(&self, a: Oid, b: Oid) -> Result<MergeBase, MergeBaseError>
Source§impl FindObjects for Repository
impl FindObjects for Repository
Source§fn find_objects<'a, 'b, I>(
&self,
refname: &Qualified<'a>,
dids: I,
) -> Result<FoundObjects, FindObjectsError>
fn find_objects<'a, 'b, I>( &self, refname: &Qualified<'a>, dids: I, ) -> Result<FoundObjects, FindObjectsError>
Source§impl ReadRepository for Repository
impl ReadRepository for Repository
Source§fn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>
fn references_of(&self, remote: &PublicKey) -> Result<Refs, Error>
The published references of the given remote.
Note that this includes all references, including refs/rad/sigrefs.
This reference must be removed before signing the payload.
§Skipped References
References created by staging::patch, i.e. references that begin
with refs/tmp/heads, are skipped.
Source§fn is_empty(&self) -> Result<bool, Error>
fn is_empty(&self) -> Result<bool, Error>
true if there are no references in the repository.Source§fn blob_at<P>(&self, commit_id: Oid, path: P) -> Result<Blob<'_>, Error>
fn blob_at<P>(&self, commit_id: Oid, path: P) -> Result<Blob<'_>, Error>
Source§fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>
fn blob(&self, oid: Oid) -> Result<Blob<'_>, Error>
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>
Source§fn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>
fn revwalk(&self, head: Oid) -> Result<Revwalk<'_>, Error>
Source§fn contains(&self, oid: Oid) -> Result<bool, Error>
fn contains(&self, oid: Oid) -> Result<bool, Error>
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>
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>
Source§fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
Source§fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>
Source§fn identity_head(&self) -> Result<Oid, RepositoryError>
fn identity_head(&self) -> Result<Oid, RepositoryError>
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>
Source§fn identity_root(&self) -> Result<Oid, RepositoryError>
fn identity_root(&self) -> Result<Oid, RepositoryError>
Source§fn identity_root_of(&self, remote: &PublicKey) -> Result<Oid, RepositoryError>
fn identity_root_of(&self, remote: &PublicKey) -> Result<Oid, RepositoryError>
Source§fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>
fn canonical_identity_head(&self) -> Result<Oid, RepositoryError>
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>
Source§fn identity(&self) -> Result<Identity, RepositoryError>where
Self: Store,
fn identity(&self) -> Result<Identity, RepositoryError>where
Self: Store,
Source§fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
fn canonical_identity_doc(&self) -> Result<DocAt, RepositoryError>
Source§fn identity_doc(&self) -> Result<DocAt, RepositoryError>
fn identity_doc(&self) -> Result<DocAt, RepositoryError>
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>
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>,
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>
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>
Source§fn manifest_of(
&self,
id: &Oid,
) -> Result<Manifest, <Repository as Storage>::LoadError>
fn manifest_of( &self, id: &Oid, ) -> Result<Manifest, <Repository as Storage>::LoadError>
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>
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>
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>
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>
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>
Source§fn validate(&self) -> Result<Validations, Error>
fn validate(&self) -> Result<Validations, Error>
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>
Source§fn set_identity_head_to(&self, commit: Oid) -> Result<(), RepositoryError>
fn set_identity_head_to(&self, commit: Oid) -> Result<(), RepositoryError>
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>
Source§fn set_user(&self, info: &UserInfo) -> Result<(), Error>
fn set_user(&self, info: &UserInfo) -> Result<(), Error>
Source§fn raw(&self) -> &Repository
fn raw(&self) -> &Repository
Source§fn set_identity_head(&self) -> Result<Oid, RepositoryError>
fn set_identity_head(&self) -> Result<Oid, RepositoryError>
Source§fn set_remote_identity_root(
&self,
remote: &PublicKey,
) -> Result<Oid, RepositoryError>
fn set_remote_identity_root( &self, remote: &PublicKey, ) -> Result<Oid, RepositoryError>
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 UnsafeUnpin 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
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>
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>
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