diff options
author | Alex Auvolat <alex@adnab.me> | 2020-11-20 20:11:04 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-11-20 20:11:04 +0100 |
commit | e9fd265ce6d326425994ccfea9d5afc7165460db (patch) | |
tree | 9dce56810d812d6b3293e20776b58bda91c05182 /src/model/object_table.rs | |
parent | b9e6b007a317bf307b209cf01667fa207d62b67d (diff) | |
download | garage-e9fd265ce6d326425994ccfea9d5afc7165460db.tar.gz garage-e9fd265ce6d326425994ccfea9d5afc7165460db.zip |
Slight refactoring to make things clearer with DeletedFilter
Diffstat (limited to 'src/model/object_table.rs')
-rw-r--r-- | src/model/object_table.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/model/object_table.rs b/src/model/object_table.rs index 719a222c..929b63f0 100644 --- a/src/model/object_table.rs +++ b/src/model/object_table.rs @@ -196,7 +196,7 @@ impl TableSchema for ObjectTable { type P = String; type S = String; type E = Object; - type Filter = (); + type Filter = DeletedFilter; async fn updated(&self, old: Option<Self::E>, new: Option<Self::E>) -> Result<(), Error> { let version_table = self.version_table.clone(); @@ -228,8 +228,9 @@ impl TableSchema for ObjectTable { Ok(()) } - fn matches_filter(entry: &Self::E, _filter: &Self::Filter) -> bool { - entry.versions.iter().any(|v| v.is_data()) + fn matches_filter(entry: &Self::E, filter: &Self::Filter) -> bool { + let deleted = !entry.versions.iter().any(|v| v.is_data()); + filter.apply(deleted) } fn try_migrate(bytes: &[u8]) -> Option<Self::E> { |