Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make set_snapshot public (simple pull request) #711

Merged
merged 2 commits into from
Jan 5, 2023

Conversation

a14e
Copy link
Contributor

@a14e a14e commented Nov 27, 2022

Good day!
I'm writing my database on top of rocks db. And I have a problem:
I want to cache snapshot (for consistency) iterator between different batch requests for stream processing, but current implementation requires lifetime and lifetime is incompatible with caching.
I'd like to do simple workaround via ReadOptions, but method set_snapshot is private. So I want to make it public =)

my current solution is:

let db: &'static DB = todo!();
let  column_family: &'static ColumnFamily = todo!();
let snapshot = db.snapshot();
let mut options = rocksdb::ReadOptions::default();
options.set_snapshot(&snapshot);
let iter = db.raw_iterator_cf_opt(column_family, options);

BusyJay pushed a commit to BusyJay/rust-rocksdb that referenced this pull request Dec 10, 2022
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
@aleksuss aleksuss merged commit 3b44ee9 into rust-rocksdb:master Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants