aboutsummaryrefslogtreecommitdiff
path: root/src/model/index_counter.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-03 15:27:36 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-03 15:27:36 +0100
commit8d5505514f950dc1ca1249a3385c9913b5b5e8e0 (patch)
treea74c043fe76deab6cb0919c6f002f0a4e87be19d /src/model/index_counter.rs
parent426d8784dac0e39879af52d980887d3692fc907c (diff)
downloadgarage-8d5505514f950dc1ca1249a3385c9913b5b5e8e0.tar.gz
garage-8d5505514f950dc1ca1249a3385c9913b5b5e8e0.zip
Make it explicit when using nonversioned encoding
Diffstat (limited to 'src/model/index_counter.rs')
-rw-r--r--src/model/index_counter.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/model/index_counter.rs b/src/model/index_counter.rs
index 3cd3083a..35d6596d 100644
--- a/src/model/index_counter.rs
+++ b/src/model/index_counter.rs
@@ -279,8 +279,8 @@ impl<T: CountedItem> IndexCounter<T> {
info!("zeroing old counters... ({})", hex::encode(&batch[0].0));
for (local_counter_k, local_counter) in batch {
- let mut local_counter =
- rmp_serde::decode::from_read_ref::<_, LocalCounterEntry<T>>(&local_counter)?;
+ let mut local_counter = LocalCounterEntry::<T>::decode(&local_counter)
+ .ok_or_message("Cannot decode local counter entry")?;
for (_, tv) in local_counter.values.iter_mut() {
tv.0 = std::cmp::max(tv.0 + 1, now);
@@ -335,9 +335,8 @@ impl<T: CountedItem> IndexCounter<T> {
let local_counter_key = self.table.data.tree_key(pk, sk);
let mut local_counter = match self.local_counter.get(&local_counter_key)? {
Some(old_bytes) => {
- let ent = rmp_serde::decode::from_read_ref::<_, LocalCounterEntry<T>>(
- &old_bytes,
- )?;
+ let ent = LocalCounterEntry::<T>::decode(&old_bytes)
+ .ok_or_message("Cannot decode local counter entry")?;
assert!(ent.pk == *pk);
assert!(ent.sk == *sk);
ent