-
Notifications
You must be signed in to change notification settings - Fork 88
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
chore: update CI toolchain and clean up code #244
Conversation
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #244 +/- ##
==========================================
+ Coverage 97.24% 97.68% +0.44%
==========================================
Files 30 30
Lines 10951 10715 -236
==========================================
- Hits 10649 10467 -182
+ Misses 302 248 -54
Continue to review full report at Codecov.
|
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
…anup-220715 Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
/cc @LykxSassinator |
240d7bc
to
b873cce
Compare
Signed-off-by: tabokie <[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.
LGTM
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 LGTM
## Run tests. | ||
ifeq ($(WITH_STABLE_TOOLCHAIN), true) | ||
test: | ||
cargo test --all --features all_stable_except_failpoints ${EXTRA_CARGO_ARGS} -- --nocapture |
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.
Recommend to add extra --color always
, making the results both on successful and failed tests more readable.
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.
Do you encounter any problem using it? I think the default auto
should work good enough.
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.
Actually,it's work fine in my environment, also on MacOS.
cargo test --test failpoints --features all_stable ${EXTRA_CARGO_ARGS} -- --test-threads 1 --nocapture | ||
else | ||
test: | ||
cargo test --all --features all_except_failpoints ${EXTRA_CARGO_ARGS} -- --nocapture |
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.
ditto.
) -> Result<()> { | ||
self.valid_offset = LogFileFormat::encode_len(format.version); | ||
self.file_id = Some(file_id); | ||
self.format = Some(format); |
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.
How about still using LogFileContext
to represent the basics of file metadata ?
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.
Similar to my other comment, because the context no longer holds alignment, using it doesn't make sense here.
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct LogFileContext { | ||
pub id: FileId, | ||
pub format: LogFileFormat, | ||
pub version: 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.
Why not introduce LogFileFormat
as an integrated representation of file metadata? Version
is just a slice of metadata in the log, but LogFileFormat
owns the whole.
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.
Hide
LogFileFormat
from outer crate, it should stay an implementation detail of file_pipe_log.
There's no need to expose it because only "file_pipe_log" needs to know about alignment.
handle, | ||
reader, | ||
// Set to an invalid offset to force a reseek at first read. | ||
offset: u64::MAX, |
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've got the purpose that u refactor the LogFileReader
and its related method build_file_reader
. But referring to the design on LogFileWriter
, I still recommend to make the parse_format
integrated into the processing of LogFileReader::open()
, rather than open()
-> manually parse_format
by callers.
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.
My change removes the format
stored inside reader, because reader doesn't need a format to function. The writer, on the other hand, needs to do format-specific initialization, so we can't refactor it like reader.
cargo clippy --all --features all_stable --all-targets -- -D clippy::all | ||
else | ||
clippy: | ||
cargo clippy --all --all-features --all-targets -- -D clippy::all |
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.
Here, don't we need +nightly
trait any more when ${WITH_STABLE_TOOLCHAIN} == false
?
I've tested the makefile on Centos:
Linux version 3.10.0-862.14.4.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Wed Sep 26 15:12:11 UTC 2018
And it returns the following failure:
error[E0554]: `#![feature]` may not be used on the stable release channel
--> src/lib.rs:16:34
|
16 | #![cfg_attr(feature = "nightly", feature(test))]
| ^^^^^^^^^^^^^
error[E0554]: `#![feature]` may not be used on the stable release channel
--> src/lib.rs:17:31
And if I add the +nightly
trait, both make test
and make clippy
worked as expectation without errs, by setting ${WITH_STABLE_TOOLCHAIN} == false
.
Also, the feature specification on all_except_failpoints
in cargo.toml
shows that we need +nightly
.
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 idea is to assume user has set the correct default toolchain. But force setting sounds okay too, I'll add it later.
Ref #235
Update toolchain to 2022-07-13, add a makefile.
A lot of minor refactoring:
scan_messages
interface to share more code paths, and add tests for them.LogFileFormat
from outer crate, it should stay an implementation detail of file_pipe_log.DataLayout
tou64
, because otherwise it needs additional care to make sureAlignment(0)
andNoAlignment
don't coexist.Signed-off-by: tabokie [email protected]