pub struct Canonical<'a, 'b, 'r, R, T> { /* private fields */ }Expand description
Canonical captures the state for finding the quorum between a set of
Dids and their references, attempting to agree on a Git commit or tag.
Construction happens through Canonical::new, at which point you must use
Canonical::find_objects so that the state has the set of Objects it
must use for the quorum calculation.
At this point, the caller can either call Canonical::quorum to find the
quorum, or modify the calculation by produce a CanonicalWithConvergence
using Canonical::with_convergence, and then using
CanonicalWithConvergence::quorum.
Implementations§
Source§impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, Initial>
impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, Initial>
Sourcepub fn new(
refname: Qualified<'a>,
rule: &'b Rule<ResolvedDelegates, Threshold>,
repo: &'r R,
) -> Canonical<'a, 'b, 'r, R, Initial>
pub fn new( refname: Qualified<'a>, rule: &'b Rule<ResolvedDelegates, Threshold>, repo: &'r R, ) -> Canonical<'a, 'b, 'r, R, Initial>
Sourcepub fn find_objects(
self,
) -> Result<Canonical<'a, 'b, 'r, R, ObjectsFound>, FindObjectsError>
pub fn find_objects( self, ) -> Result<Canonical<'a, 'b, 'r, R, ObjectsFound>, FindObjectsError>
Find the objects for the Canonical computation, and prepare it to
find the quorum.
Source§impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, ObjectsFound>
impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, ObjectsFound>
Sourcepub fn with_convergence(
self,
candidate: Did,
object: Object,
) -> CanonicalWithConvergence<'a, 'b, 'r, R>
pub fn with_convergence( self, candidate: Did, object: Object, ) -> CanonicalWithConvergence<'a, 'b, 'r, R>
Adds the check for convergence before finding the quorum.
Sourcepub fn quorum(self) -> Result<Quorum<'a>, QuorumError>
pub fn quorum(self) -> Result<Quorum<'a>, QuorumError>
Find the Quorum for the canonical computation.
Sourcepub fn missing(&self) -> &Missing
pub fn missing(&self) -> &Missing
If there are Missing objects, these may be reported by the caller,
and if further objects are found, then these can be marked using
Canonical::found_objects.
Sourcepub fn found_objects(
&mut self,
objects: impl IntoIterator<Item = (Did, Object)>,
)
pub fn found_objects( &mut self, objects: impl IntoIterator<Item = (Did, Object)>, )
Mark the objects provided as found, removing them from the Missing
set.
Trait Implementations§
Source§impl<'a, 'b, 'r, R> AsRef<Canonical<'a, 'b, 'r, R, ObjectsFound>> for CanonicalWithConvergence<'a, 'b, 'r, R>
impl<'a, 'b, 'r, R> AsRef<Canonical<'a, 'b, 'r, R, ObjectsFound>> for CanonicalWithConvergence<'a, 'b, 'r, R>
Source§fn as_ref(&self) -> &Canonical<'a, 'b, 'r, R, ObjectsFound>
fn as_ref(&self) -> &Canonical<'a, 'b, 'r, R, ObjectsFound>
Auto Trait Implementations§
impl<'a, 'b, 'r, R, T> Freeze for Canonical<'a, 'b, 'r, R, T>
impl<'a, 'b, 'r, R, T> RefUnwindSafe for Canonical<'a, 'b, 'r, R, T>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, 'b, 'r, R, T> Send for Canonical<'a, 'b, 'r, R, T>
impl<'a, 'b, 'r, R, T> Sync for Canonical<'a, 'b, 'r, R, T>
impl<'a, 'b, 'r, R, T> Unpin for Canonical<'a, 'b, 'r, R, T>where
T: Unpin,
impl<'a, 'b, 'r, R, T> UnwindSafe for Canonical<'a, 'b, 'r, R, T>where
R: RefUnwindSafe,
T: UnwindSafe,
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