aboutsummaryrefslogtreecommitdiff
path: root/src/api/k2v
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-17 11:50:23 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-17 11:50:23 +0200
commitc692f55d5ce2c3ed08db7fbc4844debcc0aeb134 (patch)
tree920712b4ccfa111f01c16e3314a872201ab04ccf /src/api/k2v
parent7b474855e3a8491fcdde69d12d3fbae27f520383 (diff)
downloadgarage-fix-k2v-305.tar.gz
garage-fix-k2v-305.zip
K2V: Fix `end` parameter and add tests (fix #305)fix-k2v-305
Diffstat (limited to 'src/api/k2v')
-rw-r--r--src/api/k2v/range.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/k2v/range.rs b/src/api/k2v/range.rs
index cd019723..295c34aa 100644
--- a/src/api/k2v/range.rs
+++ b/src/api/k2v/range.rs
@@ -74,7 +74,11 @@ where
}
}
if let Some(e) = end {
- if entry.sort_key() == e {
+ let is_finished = match enumeration_order {
+ EnumerationOrder::Forward => entry.sort_key() >= e,
+ EnumerationOrder::Reverse => entry.sort_key() <= e,
+ };
+ if is_finished {
return Ok((entries, false, None));
}
}