grand refactory to multiple list-based control api

This commit is contained in:
yggverse 2026-03-28 04:42:41 +02:00
parent 827cb182f2
commit b93c1e8481
15 changed files with 271 additions and 282 deletions

View file

@ -6,29 +6,18 @@ pub use snap::Snap;
#[derive(Default)]
pub struct Total {
entries: AtomicU64,
blocked: AtomicU64,
request: AtomicU64,
}
impl Total {
pub fn with_rules(entries: u64) -> Self {
Self {
entries: entries.into(),
..Self::default()
}
}
pub fn snap(&self, seconds_from_startup: u64) -> Snap {
Snap::shot(
self.entries.load(Ordering::Relaxed),
self.request.load(Ordering::Relaxed),
self.blocked.load(Ordering::Relaxed),
seconds_from_startup,
)
}
pub fn set_entries(&self, value: u64) {
self.entries.store(value, Ordering::Relaxed);
}
pub fn increase_blocked(&self) {
self.blocked.fetch_add(1, Ordering::Relaxed);
}