Skip to content

Commit

Permalink
Introducing DeltaReader (#7)
Browse files Browse the repository at this point in the history
* Get largest test and tests simplifications

* More tests and more renaming

* Get prev!

* Implement the rest without testing

* Clean up

* Minor comments clean up

* Add tests for get

* More test for empty delta reader

* More tests and use own type alias

* Adding more tests for collect in range

* Adding proptest for more iterator related things

* Move PaginatedResponse from lib to cache
  • Loading branch information
citizen-stig authored Jun 4, 2024
1 parent 677fa2f commit 6e8be84
Show file tree
Hide file tree
Showing 4 changed files with 1,017 additions and 18 deletions.
12 changes: 1 addition & 11 deletions src/cache/cache_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::Mutex;

use crate::cache::cache_container::CacheContainer;
use crate::cache::change_set::ChangeSet;
use crate::cache::SnapshotId;
use crate::cache::{PaginatedResponse, SnapshotId};
use crate::iterator::ScanDirection;
use crate::schema::KeyDecoder;
use crate::{
Expand All @@ -19,16 +19,6 @@ pub struct CacheDb {
db: ReadOnlyLock<CacheContainer>,
}

/// Response for a paginated query which also includes the "next" key to pass
#[derive(Debug)]
pub struct PaginatedResponse<S: Schema> {
/// A vector of storage keys and their values
pub key_value: Vec<(S::Key, S::Value)>,
/// Key indicating the first key after the final pair from key_value.
/// Meant to be passed in in subsequent queries
pub next: Option<S::Key>,
}

impl CacheDb {
/// Create new [`CacheDb`] pointing to given [`CacheContainer`]
pub fn new(id: SnapshotId, cache_container: ReadOnlyLock<CacheContainer>) -> Self {
Expand Down
Loading

0 comments on commit 6e8be84

Please sign in to comment.