Skip to main content

GroupCrdtState

Struct GroupCrdtState 

Source
pub struct GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle, OP: OperationId + Ord,
{ pub inner: GroupCrdtInnerState<ID, OP, M, C>, }
Expand description

State object for GroupCrdt containing an orderer state and the inner state.

Fields§

§inner: GroupCrdtInnerState<ID, OP, M, C>

Inner groups state.

Implementations§

Source§

impl<ID, OP, M, C> GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle, OP: OperationId + Ord, M: Operation<ID, OP, C>, C: Conditions,

Source

pub fn new() -> Self

Instantiate a new state.

Source

pub fn root_members(&self, group_id: ID) -> Vec<(GroupMember<ID>, Access<C>)>

Get all direct members of a group.

This method does not recurse into sub-groups, but rather returns only the direct group members and their access levels.

Source

pub fn members(&self, group_id: ID) -> Vec<(ID, Access<C>)>

Get all individuals of a group.

This method recurses into all sub-groups and returns a resolved list of individual group members and their access levels.

Source

pub fn groups(&self, group_id: ID) -> Vec<(ID, Access<C>)>

Get all transitive groups inside a group.

This method recurses into all sub-groups and returns a resolved list of nested group members and their access levels.

Source

pub fn traverse_members( &self, group_id: ID, depth: u32, ) -> Vec<(GroupMember<ID>, Access<C>)>

Traverse membership graph with a specified max. depth and return all visited members (individuals and transitive groups) of a group.

Set depth to 0 to traverse the full graph.

Source

pub fn has_group(&self, group_id: ID) -> bool

Returns true if the passed group exists in the current state.

Source

pub fn heads(&self) -> Vec<OP>

Current tips for the groups operation graph.

Source

pub fn heads_filtered(&self, groups: &[ID]) -> Vec<OP>

Get graph tips filtered to only those which included “create” operation for passed group ids in their causal history.

Source§

impl<ID, OP, M, C> GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle + Ord + Display, OP: OperationId + Ord + Display, M: Operation<ID, OP, C>, C: Conditions,

Source

pub fn display(&self, group_id: ID) -> String

Available on crate features test_utils only.

Print an auth group graph in DOT format for visualizing the group operation DAG.

Trait Implementations§

Source§

impl<ID, OP, M: Clone, C: Clone> Clone for GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle + Clone, OP: OperationId + Ord + Clone,

Source§

fn clone(&self) -> GroupCrdtState<ID, OP, M, C>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<ID, OP, M: Debug, C: Debug> Debug for GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle + Debug, OP: OperationId + Ord + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<ID, OP, M, C> Default for GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle, OP: OperationId + Ord, M: Operation<ID, OP, C>, C: Conditions,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, ID, OP, M, C> Deserialize<'de> for GroupCrdtState<ID, OP, M, C>
where ID: IdentityHandle + Deserialize<'de>, OP: OperationId + Ord + Deserialize<'de>, M: Deserialize<'de>, C: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<ID, OP, M, C> Serialize for GroupCrdtState<ID, OP, M, C>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<ID, OP, M, C> Freeze for GroupCrdtState<ID, OP, M, C>

§

impl<ID, OP, M, C> RefUnwindSafe for GroupCrdtState<ID, OP, M, C>

§

impl<ID, OP, M, C> Send for GroupCrdtState<ID, OP, M, C>
where OP: Send, M: Send, ID: Send, C: Send,

§

impl<ID, OP, M, C> Sync for GroupCrdtState<ID, OP, M, C>
where OP: Sync, M: Sync, ID: Sync, C: Sync,

§

impl<ID, OP, M, C> Unpin for GroupCrdtState<ID, OP, M, C>
where OP: Unpin, M: Unpin, ID: Unpin, C: Unpin,

§

impl<ID, OP, M, C> UnsafeUnpin for GroupCrdtState<ID, OP, M, C>

§

impl<ID, OP, M, C> UnwindSafe for GroupCrdtState<ID, OP, M, C>
where OP: UnwindSafe, M: UnwindSafe, ID: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Extensions for T
where T: Clone + Debug + for<'de> Deserialize<'de> + Serialize,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V