pub struct IdentityMut<'a, 'b, Repo, Signer> {
pub id: ObjectId,
/* private fields */
}Fields§
§id: ObjectIdImplementations§
Source§impl<Repo, Signer> IdentityMut<'_, '_, Repo, Signer>
impl<Repo, Signer> IdentityMut<'_, '_, Repo, Signer>
pub fn transaction<F>( &mut self, message: &str, operations: F, ) -> Result<Oid, Error>
Methods from Deref<Target = Identity>§
Sourcepub fn head(&self) -> Oid
pub fn head(&self) -> Oid
The head of the identity branch. This points to a commit that contains the current document blob.
Sourcepub fn revision(&self, revision: &Oid) -> Option<&Revision>
pub fn revision(&self, revision: &Oid) -> Option<&Revision>
A specific Revision, that may be redacted.
Sourcepub fn revisions(&self) -> impl DoubleEndedIterator
pub fn revisions(&self) -> impl DoubleEndedIterator
All the Revisions that have not been redacted.
pub fn latest_by(&self, who: &Did) -> Option<&Revision>
Methods from Deref<Target = Revision>§
pub fn signatures(&self) -> impl Iterator<Item = (&PublicKey, Signature)>
pub fn is_accepted(&self) -> bool
pub fn is_active(&self) -> bool
pub fn verdicts(&self) -> impl Iterator<Item = (&PublicKey, &Verdict)>
pub fn accepted(&self) -> impl Iterator<Item = Did>
pub fn rejected(&self) -> impl Iterator<Item = Did>
pub fn sign<G>(&self, signer: &G) -> Result<Signature, DocError>
Methods from Deref<Target = Doc>§
Sourcepub fn payload(&self) -> &BTreeMap<PayloadId, Payload>
pub fn payload(&self) -> &BTreeMap<PayloadId, Payload>
Return the associated payloads for this Doc.
Sourcepub fn project(&self) -> Result<Project, PayloadError>
pub fn project(&self) -> Result<Project, PayloadError>
Get the project payload, if it exists and is valid, out of this document.
Sourcepub fn default_branch(&self) -> Result<Qualified<'_>, DefaultBranchError>
pub fn default_branch(&self) -> Result<Qualified<'_>, DefaultBranchError>
Gets the qualified reference name of the default branch,
according to payloads xyz.radicle.project and xyz.radicle.crefs
in this document.
Sourcepub fn canonical_refs(&self) -> Result<CanonicalRefs, CanonicalRefsError>
pub fn canonical_refs(&self) -> Result<CanonicalRefs, CanonicalRefsError>
Construct the canonical references for this document.
Uses the xyz.radicle.crefs payload (if present) and the
xyz.radicle.project payload to determine the HEAD symbolic
reference and its associated rule.
There are three cases, depending on whether HEAD is already
defined in the crefs payload and whether a project payload exists:
- Explicit HEAD + project:
HEADmust agree withProject::default_branch_qualified, and the matching rule must usedelegateswith the document’s threshold. - Explicit HEAD, no project: The matching rule must use
delegateswith the document’s threshold. - No HEAD: A rule and
HEADsymbolic reference are synthesized from the project payload (which must exist).
In all cases the result must pass RawCanonicalRefs::try_into_canonical_refs
validation. If a rule for HEAD’s target is missing, it will be
caught as a dangling reference there.
Sourcepub fn visibility(&self) -> &Visibility
pub fn visibility(&self) -> &Visibility
Return the associated Visibility of this document.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Check whether the visibility of the document is private.
Sourcepub fn threshold_nonzero(&self) -> &NonZero<usize>
pub fn threshold_nonzero(&self) -> &NonZero<usize>
Return the associated threshold of this document in its non-zero format.
Sourcepub fn is_delegate(&self, did: &Did) -> bool
pub fn is_delegate(&self, did: &Did) -> bool
Check if the did is part of the Doc::delegates set.
Sourcepub fn is_visible_to(&self, did: &Did) -> bool
pub fn is_visible_to(&self, did: &Did) -> bool
Check whether this document and the associated repository is visible to the given peer.
Sourcepub fn verify_signature(
&self,
key: &PublicKey,
signature: &Signature,
blob: Oid,
) -> Result<(), PublicKey>
pub fn verify_signature( &self, key: &PublicKey, signature: &Signature, blob: Oid, ) -> Result<(), PublicKey>
Validate signature using this document’s delegates, against a given
document blob.
Sourcepub fn is_majority(&self, votes: usize) -> bool
pub fn is_majority(&self, votes: usize) -> bool
Check the provided votes passes the Doc::majority.
Sourcepub fn majority(&self) -> usize
pub fn majority(&self) -> usize
Return the majority number based on the size of the delegates set.
Sourcepub fn sign<G>(&self, signer: &G) -> Result<(Oid, Vec<u8>, Signature), DocError>
pub fn sign<G>(&self, signer: &G) -> Result<(Oid, Vec<u8>, Signature), DocError>
Doc::encode and sign the Doc, returning the set of bytes, its
corresponding Git Oid and the Signature over the Oid.
Sourcepub fn init<G>(
&self,
repo: &Repository,
signer: &Device<G>,
) -> Result<Oid, RepositoryError>
pub fn init<G>( &self, repo: &Repository, signer: &Device<G>, ) -> Result<Oid, RepositoryError>
Initialize an identity::Identity with this Doc as the associated
document.
Trait Implementations§
Source§impl<Repo, Signer> Debug for IdentityMut<'_, '_, Repo, Signer>
impl<Repo, Signer> Debug for IdentityMut<'_, '_, Repo, Signer>
Auto Trait Implementations§
impl<'a, 'b, Repo, Signer> Freeze for IdentityMut<'a, 'b, Repo, Signer>
impl<'a, 'b, Repo, Signer> RefUnwindSafe for IdentityMut<'a, 'b, Repo, Signer>where
Repo: RefUnwindSafe,
Signer: RefUnwindSafe,
impl<'a, 'b, Repo, Signer> Send for IdentityMut<'a, 'b, Repo, Signer>
impl<'a, 'b, Repo, Signer> Sync for IdentityMut<'a, 'b, Repo, Signer>
impl<'a, 'b, Repo, Signer> Unpin for IdentityMut<'a, 'b, Repo, Signer>
impl<'a, 'b, Repo, Signer> UnsafeUnpin for IdentityMut<'a, 'b, Repo, Signer>
impl<'a, 'b, Repo, Signer> UnwindSafe for IdentityMut<'a, 'b, Repo, Signer>where
Repo: RefUnwindSafe,
Signer: RefUnwindSafe,
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