aboutsummaryrefslogtreecommitdiff
path: root/src/block_ref_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-19 20:52:20 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-19 20:52:20 +0000
commit04acaea231a9af77e5ca05068336f4492fe32ac0 (patch)
tree412a346fed1a24b861a90c9a3e527e46f050ffa0 /src/block_ref_table.rs
parent5ae32972efaba357ecc0027fe852d710b16b6d0e (diff)
downloadgarage-04acaea231a9af77e5ca05068336f4492fe32ac0.tar.gz
garage-04acaea231a9af77e5ca05068336f4492fe32ac0.zip
Don't do version & block_ref updates in background on deletion
Diffstat (limited to 'src/block_ref_table.rs')
-rw-r--r--src/block_ref_table.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/block_ref_table.rs b/src/block_ref_table.rs
index 17efa155..6a256aa3 100644
--- a/src/block_ref_table.rs
+++ b/src/block_ref_table.rs
@@ -4,6 +4,7 @@ use std::sync::Arc;
use crate::background::*;
use crate::data::*;
+use crate::error::Error;
use crate::table::*;
use crate::block::*;
@@ -47,20 +48,17 @@ impl TableSchema for BlockRefTable {
type E = BlockRef;
type Filter = ();
- async fn updated(&self, old: Option<Self::E>, new: Option<Self::E>) {
+ async fn updated(&self, old: Option<Self::E>, new: Option<Self::E>) -> Result<(), Error> {
let block = &old.as_ref().or(new.as_ref()).unwrap().block;
let was_before = old.as_ref().map(|x| !x.deleted).unwrap_or(false);
let is_after = new.as_ref().map(|x| !x.deleted).unwrap_or(false);
if is_after && !was_before {
- if let Err(e) = self.block_manager.block_incref(block) {
- eprintln!("Failed to incref block {:?}: {}", block, e);
- }
+ self.block_manager.block_incref(block)?;
}
if was_before && !is_after {
- if let Err(e) = self.block_manager.block_decref(block) {
- eprintln!("Failed to decref block {:?}: {}", block, e);
- }
+ self.block_manager.block_decref(block)?;
}
+ Ok(())
}
fn matches_filter(entry: &Self::E, _filter: &Self::Filter) -> bool {