-
-
Notifications
You must be signed in to change notification settings - Fork 689
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 checksum check in ManagedDirectory #605
Conversation
Codecov Report
@@ Coverage Diff @@
## master #605 +/- ##
==========================================
- Coverage 91.03% 91.01% -0.02%
==========================================
Files 172 173 +1
Lines 17838 17990 +152
==========================================
+ Hits 16239 16374 +135
- Misses 1599 1616 +17
Continue to review full report at Codecov.
|
this is more of a poc, it require some refactoring into multiple files `terminate(self)` is implemented, but not used anywhere yet
07c819a
to
a4c47aa
Compare
use BitOrder for integer to raw byte conversion consider atomic write imply atomic read, which might not actually be true use some indirection to have a boxable terminating writer
…ould add dependancy to drop_bomb to help find where terminate() should be called implement TerminatingWrite for wrapper writers make tests pass /!\ some tests seems to pass where they shouldn't
e6c0c80
to
e3b0cbe
Compare
e3b0cbe
to
32baf73
Compare
src/directory/managed_directory.rs
Outdated
let index_version = footer[0]; | ||
match index_version { | ||
0 => Footer::V0(V0::from_bytes(footer)), | ||
_ => panic!("unsuported index_version"), |
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.
Maybe return an error?
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.
Can you add a TODO to add a "string version", so that the error message in a backward incompatibility scenario becomes more helpful?
src/directory/managed_directory.rs
Outdated
} | ||
|
||
#[derive(Debug, Copy, Clone)] | ||
pub enum Footer { |
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 think there are stuff we can force for all versions...
Should we use a
pub struct Footer {
version_configuration: VersionConfiguration,
meta: String //< human readable with information,
}
and put the Version specific information in a separate enum
.
If you want we can do that in a separate PR. In that case please add a TODO.
@fdb-hiroshima I am very happy with all of the choice you made. I added a couple of nitpicks. No need to address all of them but I think there could be more unit tests especially for serialization/deserialization. Could you also add your contribution in the CHANGELOG? |
let tantivy_patch = LittleEndian::read_u32(&footer[size - 8..]); | ||
Ok(Footer { | ||
tantivy_version: (tantivy_major, tantivy_minor, tantivy_patch), | ||
meta: String::from_utf8_lossy(&footer[size - meta_len - 20..size - 20]).into_owned(), |
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.
well thought!
.managed.json
is not checksummed as it does not write itself through ManagedDirectory, but meta.json does (which but an little bit of binary at the end of an otherwise ascii file).fix #400