pub struct Group<ID, OP, C, RS, ORD, GS>where
ID: IdentityHandle,
OP: OperationId + Ord,
RS: Resolver<ID, OP, C, ORD, GS> + Debug,
ORD: Orderer<ID, OP, GroupControlMessage<ID, C>>,
GS: GroupStore<ID, OP, C, RS, ORD>,{ /* private fields */ }Expand description
Decentralised Group Management (DGM).
The Group provides a high-level interface for creating and updating groups. These groups
provide a means for restricting access to application data and resources. Groups are
comprised of members, which may be individuals or groups, and are assigned a user-chosen
identity. Each member is assigned a unique user-chosen identifier and access level. Access
levels are used to enforce restrictions over access to data and the mutation of that data.
They are also used to grant permissions which allow for mutating the group state by adding,
removing and modifying the access level of other members.
Each Group method performs internal validation to ensure that the desired group action is
valid in light of the current group state. Attempting to perform an invalid action results in a
GroupError. For example, attempting to remove a member who is not currently part of the
group.
Implementations§
Source§impl<ID, OP, C, RS, ORD, GS> Group<ID, OP, C, RS, ORD, GS>where
ID: IdentityHandle,
OP: OperationId + Ord,
RS: Resolver<ID, OP, C, ORD, GS> + Debug,
ORD: Orderer<ID, OP, GroupControlMessage<ID, C>>,
GS: GroupStore<ID, OP, C, RS, ORD>,
impl<ID, OP, C, RS, ORD, GS> Group<ID, OP, C, RS, ORD, GS>where
ID: IdentityHandle,
OP: OperationId + Ord,
RS: Resolver<ID, OP, C, ORD, GS> + Debug,
ORD: Orderer<ID, OP, GroupControlMessage<ID, C>>,
GS: GroupStore<ID, OP, C, RS, ORD>,
Trait Implementations§
Source§impl<ID, OP, C, RS, ORD, GS> Group<ID, OP, C, ORD> for Group<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>> + Clone + Debug,
ORD::Operation: Clone,
ORD::State: Clone,
GS: GroupStore<ID, OP, C, RS, ORD> + Clone + Debug,
impl<ID, OP, C, RS, ORD, GS> Group<ID, OP, C, ORD> for Group<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>> + Clone + Debug,
ORD::Operation: Clone,
ORD::State: Clone,
GS: GroupStore<ID, OP, C, RS, ORD> + Clone + Debug,
Source§fn create(
&self,
group_id: ID,
members: Vec<(GroupMember<ID>, Access<C>)>,
) -> Result<(Self::State, ORD::Operation), Self::Error>
fn create( &self, group_id: ID, members: Vec<(GroupMember<ID>, Access<C>)>, ) -> Result<(Self::State, ORD::Operation), Self::Error>
Create a group.
The creator of the group is automatically added as a manager.
The caller of this method must ensure that the given group_id is globally unique. For
example, using a collision-resistant hash.
Source§fn create_from_remote(
&self,
remote_operation: ORD::Operation,
) -> Result<Self::State, Self::Error>
fn create_from_remote( &self, remote_operation: ORD::Operation, ) -> Result<Self::State, Self::Error>
Create a group by processing a remote operation.
Source§fn receive_from_remote(
y: Self::State,
remote_operation: ORD::Operation,
) -> Result<Self::State, Self::Error>
fn receive_from_remote( y: Self::State, remote_operation: ORD::Operation, ) -> Result<Self::State, Self::Error>
Update the group by processing a remotely-authored action.
The group_id of the given operation must be the same as that of the given y; failure to
meet this condition will result in an error.
Source§fn add(
y: Self::State,
adder: ID,
added: ID,
access: Access<C>,
) -> Result<(Self::State, ORD::Operation), Self::Error>
fn add( y: Self::State, adder: ID, added: ID, access: Access<C>, ) -> Result<(Self::State, ORD::Operation), Self::Error>
Add a group member.
The adder must be a manager and the added identity must not already be a member of
the group; failure to meet these conditions will result in an error.
Source§fn remove(
y: Self::State,
remover: ID,
removed: ID,
) -> Result<(Self::State, ORD::Operation), Self::Error>
fn remove( y: Self::State, remover: ID, removed: ID, ) -> Result<(Self::State, ORD::Operation), Self::Error>
Remove a group member.
The remover must be a manager and the removed identity must already be a member
of the group; failure to meet these conditions will result in an error. A member can only
remove themself from the group if they are a manager.
Source§fn promote(
y: Self::State,
promoter: ID,
promoted: ID,
access: Access<C>,
) -> Result<(Self::State, ORD::Operation), Self::Error>
fn promote( y: Self::State, promoter: ID, promoted: ID, access: Access<C>, ) -> Result<(Self::State, ORD::Operation), Self::Error>
Promote a group member to the given access level.
The promoter must be a manager and the promoted identity must already be a member of
the group; failure to meet these conditions will result in an error. A redundant access
level assignment will also result in an error; for example, if the promoted member
currently has Read access and the given access is also Read.
Source§fn demote(
y: Self::State,
demoter: ID,
demoted: ID,
access: Access<C>,
) -> Result<(Self::State, ORD::Operation), Self::Error>
fn demote( y: Self::State, demoter: ID, demoted: ID, access: Access<C>, ) -> Result<(Self::State, ORD::Operation), Self::Error>
Demote a group member to the given access level.
The demoter must be a manager and the demoted identity must already be a member of
the group; failure to meet these conditions will result in an error. A redundant access
level assignment will also result in an error; for example, if the demoted member
currently has Manage access and the given access is also Manage.