Skip to content

Commit

Permalink
fix pagination in rocksdb wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
aditiharini committed Dec 6, 2024
1 parent dc2da5a commit a9317e0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/storage/db/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,24 @@ impl RocksDB {
Some(prefix) => prefix,
};

let upper_bound = match &page_options.page_token {
None => stop_iterator_prefix,
Some(page_token) => page_token.clone(),
let upper_bound = if page_options.reverse {
if let Some(page_token) = &page_options.page_token {
page_token.clone()
} else {
stop_iterator_prefix.clone()
}
} else {
stop_iterator_prefix.clone()
};

let lower_bound = match &page_options.page_token {
None => start_iterator_prefix,
Some(page_token) => increment_vec_u8(page_token),
let lower_bound = if page_options.reverse {
start_iterator_prefix
} else {
if let Some(page_token) = &page_options.page_token {
increment_vec_u8(&page_token)
} else {
start_iterator_prefix
}
};

let mut opts = rocksdb::ReadOptions::default();
Expand Down

0 comments on commit a9317e0

Please sign in to comment.