Skip to main content

GroupCrdt

Struct GroupCrdt 

Source
pub struct GroupCrdt<ID, OP, M, C, RS> { /* private fields */ }
Expand description

Core group CRDT for maintaining group membership state in a decentralized system.

Group members can be assigned different access levels, where only a sub-set of members can mutate the state of the group itself. Group members can be (immutable) individuals or (mutable) sub-groups.

The core data type is a Directed Acyclic Graph of all operations containing group management actions. Operations refer to the previous global state (set of graph tips) in their “dependencies” field, this is the local state when an actor creates a new auth action; these references make up the edges in the graph.

A requirement of the protocol is that all messages are processed in partial-order. When using a dependency graph structure (as is the case in this implementation) it is possible to achieve partial-ordering by only processing a message once all it’s dependencies have themselves been processed.

Group state is maintained using the state object GroupMembersState. Every time an action is processed, a new state is generated and added to the map of all states. When a new operation is received, it’s previous state is calculated and then the message applied, resulting in a new state.

Group membership rules are checked when an action is applied to the previous state, read more in the crdt::state module.

The struct has several generic parameters which allow users to specify their own core types and to customise behavior when handling concurrent changes when resolving a graph to it’s final state.

  • ID : identifier for both an individual actor and group.
  • OP : identifier for an operation.
  • C : conditions which restrict an access level.
  • RS : generic resolver which contains logic for deciding when group state rebuilds are required, and how concurrent actions are handled. See the resolver module for different implementations.
  • ORD: orderer which exposes an API for creating and processing operations with meta-data which allow them to be processed in partial order.

Implementations§

Source§

impl<ID, OP, M, C, RS> GroupCrdt<ID, OP, M, C, RS>
where ID: IdentityHandle, OP: OperationId + Ord, M: Operation<ID, OP, C> + Clone, C: Conditions, RS: Resolver<ID, OP, M, C, State = GroupCrdtInnerState<ID, OP, M, C>>,

Source

pub fn init() -> GroupCrdtState<ID, OP, M, C>

Source

pub fn process( y: GroupCrdtState<ID, OP, M, C>, operation: &M, ) -> Result<GroupCrdtState<ID, OP, M, C>, GroupCrdtError<ID, OP, M, C, RS>>

Process an operation created locally or received from a remote peer.

Trait Implementations§

Source§

impl<ID: Clone, OP: Clone, M: Clone, C: Clone, RS: Clone> Clone for GroupCrdt<ID, OP, M, C, RS>

Source§

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

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: Debug, OP: Debug, M: Debug, C: Debug, RS: Debug> Debug for GroupCrdt<ID, OP, M, C, RS>

Source§

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

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

impl<ID: Default, OP: Default, M: Default, C: Default, RS: Default> Default for GroupCrdt<ID, OP, M, C, RS>

Source§

fn default() -> GroupCrdt<ID, OP, M, C, RS>

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

Auto Trait Implementations§

§

impl<ID, OP, M, C, RS> Freeze for GroupCrdt<ID, OP, M, C, RS>

§

impl<ID, OP, M, C, RS> RefUnwindSafe for GroupCrdt<ID, OP, M, C, RS>

§

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

§

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

§

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

§

impl<ID, OP, M, C, RS> UnsafeUnpin for GroupCrdt<ID, OP, M, C, RS>

§

impl<ID, OP, M, C, RS> UnwindSafe for GroupCrdt<ID, OP, M, C, RS>

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> 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