pub struct StoreCountsHandle { /* private fields */ }Expand description
A cloneable reader of one or more CountingStores’ counters.
Handed out where a store is built, beside the store itself, so a test can
take a snapshot of a store it only holds as Arc<dyn DurableStore>. A
handle over several stores answers their sum: the work of one journey,
wherever it landed.
Implementations§
Source§impl StoreCountsHandle
impl StoreCountsHandle
Sourcepub fn store_count(&self) -> usize
pub fn store_count(&self) -> usize
The number of independently counted stores read by this handle.
Sourcepub fn install_observer(
&self,
names: &[&str],
observer: Arc<dyn StoreCountObserver>,
) -> Result<(), DurabilityError>
pub fn install_observer( &self, names: &[&str], observer: Arc<dyn StoreCountObserver>, ) -> Result<(), DurabilityError>
Installs one observer with one nonempty name for each counted store.
§Errors
Refuses absent stores, a name count mismatch, empty names, duplicate stores, an already installed observer, or a poisoned installation lock. Refusals detected during validation leave every store unchanged.
Sourcepub fn snapshot(&self) -> StoreCounts
pub fn snapshot(&self) -> StoreCounts
Every counter, summed over the stores this handle reads, as it stands
now. See CountingStore::snapshot for what a snapshot taken during
a call may miss.