aboutsummaryrefslogtreecommitdiff
path: root/src/model/key_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-03 18:03:12 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-04 12:52:46 +0100
commitba7f268b990cd17c5d20bf9e0eb6ff77d30fe845 (patch)
tree96cf583c618ab778130b4923e05d62bfb76dd224 /src/model/key_table.rs
parentde37658b94d6ac54721e18316dd8dddf50589afb (diff)
downloadgarage-ba7f268b990cd17c5d20bf9e0eb6ff77d30fe845.tar.gz
garage-ba7f268b990cd17c5d20bf9e0eb6ff77d30fe845.zip
Rename and change query filters
Diffstat (limited to 'src/model/key_table.rs')
-rw-r--r--src/model/key_table.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index daea5473..7afa0337 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -152,7 +152,7 @@ pub struct KeyTable;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum KeyFilter {
Deleted(DeletedFilter),
- Matches(String),
+ MatchesAndNotDeleted(String),
}
impl TableSchema for KeyTable {
@@ -166,10 +166,11 @@ impl TableSchema for KeyTable {
fn matches_filter(entry: &Self::E, filter: &Self::Filter) -> bool {
match filter {
KeyFilter::Deleted(df) => df.apply(entry.state.is_deleted()),
- KeyFilter::Matches(pat) => {
+ KeyFilter::MatchesAndNotDeleted(pat) => {
let pat = pat.to_lowercase();
- entry.key_id.to_lowercase().starts_with(&pat)
- || entry.name.get().to_lowercase() == pat
+ !entry.state.is_deleted()
+ && (entry.key_id.to_lowercase().starts_with(&pat)
+ || entry.name.get().to_lowercase() == pat)
}
}
}