Implement remaining TestClient service commands (#94)
This commit is contained in:
@@ -28,6 +28,11 @@ fn mutex<T>(value: &Mutex<T>) -> std::sync::MutexGuard<'_, T> {
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
fn read<T>(value: &RwLock<T>) -> std::sync::RwLockReadGuard<'_, T> {
|
||||
value
|
||||
.read()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
fn write<T>(value: &RwLock<T>) -> std::sync::RwLockWriteGuard<'_, T> {
|
||||
value
|
||||
.write()
|
||||
@@ -260,6 +265,15 @@ impl GroupManager {
|
||||
pub fn current_group_count(&self) -> i32 {
|
||||
self.inner.group_count.load(Ordering::Acquire)
|
||||
}
|
||||
|
||||
/// Returns a stable snapshot of the groups currently reported for this agent.
|
||||
///
|
||||
/// The cache is replaced atomically whenever an `AgentGroupDataUpdate` arrives,
|
||||
/// so callers never observe a partially decoded group list.
|
||||
#[must_use]
|
||||
pub fn current_groups(&self) -> HashMap<UUID, Group> {
|
||||
read(&self.inner.groups).clone()
|
||||
}
|
||||
pub fn group_membership_limit(&self) -> i32 {
|
||||
let mut client = (*self.inner.client).clone();
|
||||
client.self_().benefits().group_membership_limit()
|
||||
|
||||
Reference in New Issue
Block a user