GroupCrdtState

Struct GroupCrdtState 

Source
pub struct GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle, OP: OperationId, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>>, GS: GroupStore<ID, OP, C, RS, ORD>,
{ pub my_id: ID, pub group_id: ID, pub states: HashMap<OP, GroupMembersState<GroupMember<ID>, C>>, pub operations: HashMap<OP, ORD::Operation>, pub ignore: HashSet<OP>, pub graph: DiGraphMap<OP, ()>, pub orderer_y: ORD::State, pub group_store: GS, /* private fields */ }
Expand description

State object for GroupCrdt containing the operation graph and all incremental group states.

Requires access to a global orderer and group store.

Fields§

§my_id: ID

ID of the local actor.

§group_id: ID

ID of the group.

§states: HashMap<OP, GroupMembersState<GroupMember<ID>, C>>

Group state at every position in the operation graph.

§operations: HashMap<OP, ORD::Operation>

All operations processed by this group.

§ignore: HashSet<OP>

All operations who’s actions should be ignored.

§graph: DiGraphMap<OP, ()>

Operation graph for this group.

§orderer_y: ORD::State

State for the orderer.

§group_store: GS

All groups known to this instance.

Implementations§

Source§

impl<ID, OP, C, RS, ORD, GS> GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle, OP: OperationId + Ord, C: Clone + Debug + PartialEq + PartialOrd, RS: Resolver<ID, OP, C, ORD, GS> + Debug, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>> + Debug, GS: GroupStore<ID, OP, C, RS, ORD> + Debug,

Source

pub fn new( my_id: ID, group_id: ID, group_store: GS, orderer_y: ORD::State, ) -> Self

Instantiate a new group state.

Source

pub fn id(&self) -> ID

Id of this group.

Source

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

Current tips for the group operation graph.

Source

pub fn transitive_heads( &self, ) -> Result<HashSet<OP>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Current tips of the group operation graph including all sub-groups.

Source

pub fn current_state(&self) -> GroupMembersState<GroupMember<ID>, C>

Current state of this group.

This method gets the state at all graph tips and then merges them together into one new state which represents the current state of the group.

Source

pub fn state_at( &self, dependencies: &HashSet<OP>, ) -> GroupMembersState<GroupMember<ID>, C>

Get the state of a group at a certain point in it’s history.

Source

pub fn members_at( &self, dependencies: &HashSet<OP>, ) -> Vec<(GroupMember<ID>, Access<C>)>

Get the group members at a certain point in groups history.

Source

pub fn transitive_members_at( &self, dependencies: &HashSet<OP>, ) -> Result<Vec<(ID, Access<C>)>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Get all transitive members of the group at a certain point in it’s history.

This method recurses into all sub-groups collecting all “tip” members, which are the stateless “individual” members of a group, likely identified by a public key.

Source

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

Get all current members of the group.

Source

pub fn transitive_members( &self, ) -> Result<Vec<(ID, Access<C>)>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Get all current transitive members of the group.

This method recurses into all sub-groups collecting all “tip” members, which are the stateless “individual” members of a group, likely identified by a public key.

Source

pub fn max_access_identity( &self, actor: ID, dependencies: &HashSet<OP>, ) -> Result<Option<(GroupMember<ID>, Access<C>)>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Get the maximum given access level for an actor at a certain point in the auth graph.

An actor can be a direct individual member of a group, or a transitive member via a sub-group. This is a helper method which finds the hightest access level a member has and returns the group member which gives this actor the found access level.

The passed dependencies array tells us which position in the graph to look at.

Source§

impl<ID, OP, C, RS, ORD, GS> GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle + Ord + Display, OP: OperationId + Ord + Display, C: Clone + Debug + PartialEq + PartialOrd, RS: Resolver<ID, OP, C, ORD, GS> + Clone + Debug, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>> + Clone + Debug, ORD::State: Clone, ORD::Operation: Clone, GS: GroupStore<ID, OP, C, RS, ORD> + Clone + Debug,

Source

pub fn display(&self) -> String

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

Trait Implementations§

Source§

impl<ID, OP, C: Clone, RS: Clone, ORD, GS> Clone for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle + Clone, OP: OperationId + Clone, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>> + Clone, GS: GroupStore<ID, OP, C, RS, ORD> + Clone, ORD::Operation: Clone, ORD::State: Clone,

Source§

fn clone(&self) -> GroupCrdtState<ID, OP, C, RS, ORD, GS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<ID, OP, C: Debug, RS: Debug, ORD, GS> Debug for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle + Debug, OP: OperationId + Debug, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>> + Debug, GS: GroupStore<ID, OP, C, RS, ORD> + Debug, ORD::Operation: Debug, ORD::State: Debug,

Source§

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

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

impl<ID, OP, C, RS, ORD, GS> GroupMembership<ID, OP, C> for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: IdentityHandle + Display, OP: OperationId + Ord + Display, C: Clone + Debug + PartialEq + PartialOrd, RS: Resolver<ID, OP, C, ORD, GS> + Debug, ORD: Orderer<ID, OP, GroupControlMessage<ID, C>> + Debug, GS: GroupStore<ID, OP, C, RS, ORD> + Debug,

Source§

fn access( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<Access<C>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Query the current access level of the given member.

The member is expected to be a “stateless” individual, not a “stateful” group.

Source§

fn member_ids( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, ) -> Result<HashSet<ID>, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Query group membership.

Source§

fn is_member( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<bool, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Return true if the given ID is an active member of the group.

Source§

fn is_puller( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<bool, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Return true if the given member is currently assigned the Pull access level.

Source§

fn is_reader( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<bool, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Return true if the given member is currently assigned the Read access level.

Source§

fn is_writer( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<bool, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Return true if the given member is currently assigned the Write access level.

Source§

fn is_manager( y: &GroupCrdtState<ID, OP, C, RS, ORD, GS>, member: &ID, ) -> Result<bool, GroupCrdtError<ID, OP, C, RS, ORD, GS>>

Return true if the given member is currently assigned the Manage access level.

Source§

type State = GroupCrdtState<ID, OP, C, RS, ORD, GS>

Source§

type Error = GroupCrdtError<ID, OP, C, RS, ORD, GS>

Auto Trait Implementations§

§

impl<ID, OP, C, RS, ORD, GS> Freeze for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: Freeze, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::State: Freeze, GS: Freeze,

§

impl<ID, OP, C, RS, ORD, GS> RefUnwindSafe for GroupCrdtState<ID, OP, C, RS, ORD, GS>

§

impl<ID, OP, C, RS, ORD, GS> Send for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: Send, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::State: Send, GS: Send, RS: Send, OP: Send, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::Operation: Send, C: Send,

§

impl<ID, OP, C, RS, ORD, GS> Sync for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: Sync, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::State: Sync, GS: Sync, RS: Sync, OP: Sync, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::Operation: Sync, C: Sync,

§

impl<ID, OP, C, RS, ORD, GS> Unpin for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: Unpin, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::State: Unpin, GS: Unpin, RS: Unpin, OP: Unpin, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::Operation: Unpin, C: Unpin,

§

impl<ID, OP, C, RS, ORD, GS> UnwindSafe for GroupCrdtState<ID, OP, C, RS, ORD, GS>
where ID: UnwindSafe, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::State: UnwindSafe, GS: UnwindSafe, OP: UnwindSafe, <ORD as Orderer<ID, OP, GroupControlMessage<ID, C>>>::Operation: UnwindSafe, RS: 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<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> 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