Skip to content

Commit

Permalink
chore: apply suggestions from CR
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Oct 18, 2023
1 parent d67801e commit 06daf6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/common/meta/src/kv_backend/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ impl<T: ErrorExt + Send + Sync + 'static> KvBackend for MemoryKvBackend<T> {
let iter = kvs.range(range);

let mut more = false;
let mut counter = 0usize;
let mut took = 0;

let kvs = iter
.take_while(|_| {
let take = counter != limit as usize || limit == 0;
counter += 1;
more = counter > limit as usize && limit != 0;
let take = limit == 0 || took != limit;
took += 1;
more = limit > 0 && took > limit;

take
})
Expand Down
4 changes: 1 addition & 3 deletions src/log-store/src/raft_engine/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ impl KvBackend for RaftEngineBackend {
} = req;

let (start_key, end_key) = match (start, end) {
(Included(start), Included(_)) => {
(Some(start.clone()), Some(get_next_prefix_key(&start)))
}
(Included(start), Included(end)) => (Some(start), Some(get_next_prefix_key(&end))),
(Unbounded, Unbounded) => (None, None),
(Included(start), Excluded(end)) => (Some(start), Some(end)),
(Included(start), Unbounded) => (Some(start), None),
Expand Down

0 comments on commit 06daf6f

Please sign in to comment.