[store]: refactor: use SledTree:scan_prefix() to impl kv list
@@ -735,11 +735,9 @@ impl StateMachine {
pub fn prefix_list_kv(&self, prefix: &str) -> Vec<(String, SeqValue<KVValue>)> {
let kvs = self.kvs();
// TODO(xp): handle error
- let kv_pairs = kvs.range(prefix.to_string()..).unwrap();
+ let kv_pairs = kvs.scan_prefix(&prefix.to_string()).unwrap();
- let x = kv_pairs
- .into_iter()
- .take_while(|(k, _)| k.starts_with(prefix));
+ let x = kv_pairs.into_iter();
// Convert expired to None
let x = x.map(|(k, v)| (k, Self::unexpired(v)));
