aboutsummaryrefslogtreecommitdiff
path: root/src/version_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-17 14:49:10 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-17 14:49:10 +0200
commit867646093b24a9bb7e4b24a7f2248615c6e03fde (patch)
tree3e4c371c507112eb7f22d319303294ea3afca732 /src/version_table.rs
parent6ce14e2c9eb1ba81add3f61377a5a83854880b42 (diff)
downloadgarage-867646093b24a9bb7e4b24a7f2248615c6e03fde.tar.gz
garage-867646093b24a9bb7e4b24a7f2248615c6e03fde.zip
Table range deletion
Diffstat (limited to 'src/version_table.rs')
-rw-r--r--src/version_table.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/version_table.rs b/src/version_table.rs
index 797b9348..77a7560d 100644
--- a/src/version_table.rs
+++ b/src/version_table.rs
@@ -63,12 +63,12 @@ impl TableSchema for VersionTable {
type S = EmptySortKey;
type E = Version;
- async fn updated(&self, old: Option<Self::E>, new: Self::E) {
+ async fn updated(&self, old: Option<Self::E>, new: Option<Self::E>) {
let block_ref_table = self.block_ref_table.clone();
- self.background.spawn(async move {
+ if let (Some(old_v), Some(new_v)) = (old, new) {
// Propagate deletion of version blocks
- if let Some(old_v) = old {
- if new.deleted && !old_v.deleted {
+ self.background.spawn(async move {
+ if new_v.deleted && !old_v.deleted {
let deleted_block_refs = old_v
.blocks
.iter()
@@ -80,8 +80,8 @@ impl TableSchema for VersionTable {
.collect::<Vec<_>>();
block_ref_table.insert_many(&deleted_block_refs[..]).await?;
}
- }
- Ok(())
- });
+ Ok(())
+ });
+ }
}
}