pub struct AuthoritySet {
pub owners: HashSet<NodeId>,
pub delegates: HashMap<NodeId, AuthorityScope>,
pub revoked: HashSet<NodeId>,
}Expand description
Authority set - who can mutate a state atom
Fields§
§owners: HashSet<NodeId>Nodes with full authority
delegates: HashMap<NodeId, AuthorityScope>Nodes with delegated authority (with scope)
revoked: HashSet<NodeId>Explicitly revoked nodes
Implementations§
Source§impl AuthoritySet
impl AuthoritySet
pub fn new() -> Self
pub fn with_owner(owner: NodeId) -> Self
Check if a node has authority to perform an operation
Sourcepub fn add_delegate(&mut self, node: NodeId, scope: AuthorityScope)
pub fn add_delegate(&mut self, node: NodeId, scope: AuthorityScope)
Add a delegate with limited scope
Sourcepub fn contains(&self, node: &NodeId) -> bool
pub fn contains(&self, node: &NodeId) -> bool
Check if a node is in the authority set (owner or delegate)
Sourcepub fn is_revoked(&self, node: &NodeId) -> bool
pub fn is_revoked(&self, node: &NodeId) -> bool
Check if a node is revoked
Trait Implementations§
Source§impl Clone for AuthoritySet
impl Clone for AuthoritySet
Source§fn clone(&self) -> AuthoritySet
fn clone(&self) -> AuthoritySet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AuthoritySet
impl Debug for AuthoritySet
Source§impl Default for AuthoritySet
impl Default for AuthoritySet
Source§fn default() -> AuthoritySet
fn default() -> AuthoritySet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuthoritySet
impl RefUnwindSafe for AuthoritySet
impl Send for AuthoritySet
impl Sync for AuthoritySet
impl Unpin for AuthoritySet
impl UnwindSafe for AuthoritySet
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
Mutably borrows from an owned value. Read more