-
Notifications
You must be signed in to change notification settings - Fork 89
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
add scan_messages
for iterating over messages
#234
Conversation
…s than given key Signed-off-by: 5kbpers <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #234 +/- ##
==========================================
- Coverage 97.19% 96.74% -0.45%
==========================================
Files 30 30
Lines 9368 9517 +149
==========================================
+ Hits 9105 9207 +102
- Misses 263 310 +47
Continue to review full report at Codecov.
|
Signed-off-by: 5kbpers <[email protected]>
src/engine.rs
Outdated
) -> Result<()> | ||
where | ||
S: Message, | ||
C: FnMut(&[u8], S) -> Result<bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think user should use crate::Result
.
C: FnMut(&[u8], S) -> Result<bool>, | |
C: FnMut(&[u8], S) -> bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used for catching errors when something goes wrong on value scanned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is user shouldn't fake their own errors as crate::Error
. Say you can get away with wrapping it into a Error::Other
now, but what if the Other
variant is removed in the future?
assert_eq!(memtable.get_leq(b"key9"), Some(v5.to_vec())); | ||
|
||
let mut res = vec![]; | ||
memtable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move some tests to engine.rs to improve coverage
src/engine.rs
Outdated
start_key: &[u8], | ||
end_key: &[u8], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option?
Signed-off-by: 5kbpers <[email protected]>
Signed-off-by: 5kbpers <[email protected]>
Signed-off-by: 5kbpers <[email protected]>
Signed-off-by: 5kbpers <[email protected]>
Signed-off-by: 5kbpers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest looks good.
src/engine.rs
Outdated
Ok(()) | ||
} | ||
|
||
pub fn scan<C>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn scan<C>( | |
pub fn scan_raw_messages<C>( |
src/engine.rs
Outdated
@@ -224,6 +224,47 @@ where | |||
Ok(None) | |||
} | |||
|
|||
pub fn scan_message<S, C>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn scan_message<S, C>( | |
pub fn scan_messages<S, C>( |
Signed-off-by: 5kbpers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, update CHANGELOG.md.
scan_messages
for iterating over messages
Signed-off-by: 5kbpers <[email protected]>
CHANGELOG.md
Outdated
@@ -9,6 +9,7 @@ | |||
### New Features | |||
|
|||
* Add `PerfContext` which records detailed time breakdown of the write process to thread-local storage. | |||
* Add `Engine::scan_messages` and `Engine::scan_raw_messages` for iterating over written key-values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better under "Public API Changes"
Signed-off-by: 5kbpers <[email protected]>
Signed-off-by: 5kbpers [email protected]