pub struct RoleMap { /* private fields */ }Expand description
Ordered mapping from cert patterns to roles.
Thread-safe: wrapped in RwLock so reload can swap the mapping live
without restarting the server.
Implementations§
Source§impl RoleMap
impl RoleMap
Sourcepub fn new(default: Role) -> Self
pub fn new(default: Role) -> Self
Build a role map whose default role for unmatched peers is default.
Sourcepub fn push(&self, entry: RoleMapEntry)
pub fn push(&self, entry: RoleMapEntry)
Add a rule to the end of the chain.
Sourcepub fn reload(&self, entries: Vec<RoleMapEntry>)
pub fn reload(&self, entries: Vec<RoleMapEntry>)
Replace the entire rule list atomically.
Useful for live-reload of the role map when the operator rotates the private CA or adds a new validator.
Sourcepub fn resolve(&self, cert: &PeerCertInfo) -> Role
pub fn resolve(&self, cert: &PeerCertInfo) -> Role
Resolve a peer cert to its role.
Returns the first matching entry’s role, or the default role if
no entry matches.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RoleMap
impl !RefUnwindSafe for RoleMap
impl Send for RoleMap
impl Sync for RoleMap
impl Unpin for RoleMap
impl UnsafeUnpin for RoleMap
impl UnwindSafe for RoleMap
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