-
Notifications
You must be signed in to change notification settings - Fork 12
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
Improve fwdctl dump #764
base: main
Are you sure you want to change the base?
Improve fwdctl dump #764
Conversation
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.
This looks really good! A few things we need before landing:
- Error handling when writing is very important here. We can't drop IO errors, or we risk having a bad dump with no warning
- Continuation has to support hash key values, not just text. If the next key is binary, the lossy UTF-8 inputs won't work correctly. Maybe we need
start-key-hex
? - Small bug in the stop key
Otherwise, this looks fantastic! Great test coverage!
The remaining comments are mostly style preferences and are not mandatory.
fwdctl/src/dump.rs
Outdated
|
||
trait OutputHandler { | ||
fn handle_record(&mut self, key: &[u8], value: &[u8]); | ||
fn flush(&mut self); |
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 debated implementing flush
as a Drop
for those implementations that require it, but that limits your error handling to panic.
Thanks for reviewing the code! I pushed some commits to improve. It should be ready to be reviewed now. |
Purpose
This change is to address issue #348.
Detail
This added flags such as
--start-key
,--stop-key
,--max-key-count
and--output-format
withcsv
,json
as options andstdout
as default behavior.Test
Tested locally & unit tests added