-
Notifications
You must be signed in to change notification settings - Fork 60
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
Move log segment into separate module #438
Move log segment into separate module #438
Conversation
Log segment is going to be used by both snapshot and table changes. It makes sense to separate it into its own module
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #438 +/- ##
==========================================
- Coverage 78.96% 78.95% -0.01%
==========================================
Files 55 56 +1
Lines 12226 12216 -10
Branches 12226 12216 -10
==========================================
- Hits 9654 9645 -9
- Misses 2050 2052 +2
+ Partials 522 519 -3 ☔ View full report in Codecov by Sentry. |
kernel/src/log_segment.rs
Outdated
if metadata_opt.is_some() && protocol_opt.is_some() { | ||
// we've found both, we can stop | ||
break; | ||
} | ||
} | ||
match (metadata_opt, protocol_opt) { | ||
(Some(m), Some(p)) => Ok((m, p)), | ||
(None, Some(_)) => Err(Error::MissingMetadata), | ||
(Some(_), None) => Err(Error::MissingProtocol), | ||
_ => Err(Error::MissingMetadataAndProtocol), | ||
} |
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 always wondered why not do:
if metadata_opt.is_some() && protocol_opt.is_some() { | |
// we've found both, we can stop | |
break; | |
} | |
} | |
match (metadata_opt, protocol_opt) { | |
(Some(m), Some(p)) => Ok((m, p)), | |
(None, Some(_)) => Err(Error::MissingMetadata), | |
(Some(_), None) => Err(Error::MissingProtocol), | |
_ => Err(Error::MissingMetadataAndProtocol), | |
} | |
if let (Some(m), Some(p)) = (metadata_opt, protocol_opt) { | |
return Ok((m, p)) | |
} | |
} | |
match (metadata_opt, protocol_opt) { | |
(_, Some(_)) => Err(Error::MissingMetadata), | |
(Some(_), _) => Err(Error::MissingProtocol), | |
_ => Err(Error::MissingMetadataAndProtocol), | |
} |
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 moves metadata_opt
and protocol_opt
early in the if let
. So they're dropped before the match. It's weird because it shouldn't move if the let
doesn't match :/
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.
Yikes. I also wouldn't have expected a non-matching if let
to move??
a55bc73
to
81d0de0
Compare
Co-authored-by: Ryan Johnson <[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 but question on visibility of the new module and can we call out breaking change in PR description?
What changes are proposed in this pull request?
This PR is a prefactor that moves
LogSegment
into its own module. This will be useful to implementTableChanges
for change data feed.TableChanges
will represent CDF scans and will depend onLogSegment
. SinceTableChanges
andSnapshot
both depend onLogSegment
, it makes sense to keep it separated.I also use this opportunity to address some nits in the codebase.
How was this change tested?
The changes compile.