diff options
Diffstat (limited to 'database/src/kv/counters.rs')
| -rw-r--r-- | database/src/kv/counters.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/database/src/kv/counters.rs b/database/src/kv/counters.rs deleted file mode 100644 index c5fd5f9..0000000 --- a/database/src/kv/counters.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of jellything (https://codeberg.org/metamuffin/jellything) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2026 metamuffin <metamuffin.org> -*/ -use crate::{ - Query, - kv::{SubtreeNum, binning::Binning, helpers::read_counter}, -}; -use anyhow::Result; -use jellyobject::Object; -use std::collections::HashMap; - -pub(crate) struct Counters(pub HashMap<Binning, SubtreeNum>); -impl Counters { - pub fn update( - &self, - txn: &mut dyn jellykv::Transaction, - ob: Object<'_>, - remove: bool, - ) -> Result<()> { - Ok(()) - } - pub fn count(&self, txn: &dyn jellykv::Transaction, query: &Query) -> Result<Option<u64>> { - let mut total = 0; - for binning in query.filter.get_bins() { - let Some(b) = self.0.get(&binning) else { - return Ok(None); - }; - total += read_counter(txn, *b, 0)?; - } - Ok(Some(total)) - } -} |