-
Notifications
You must be signed in to change notification settings - Fork 465
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
storage: flatten StorageCommand
and StorageResponse
#31261
base: main
Are you sure you want to change the base?
storage: flatten StorageCommand
and StorageResponse
#31261
Conversation
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
58bd1a6
to
6a9c057
Compare
Signed-off-by: Petros Angelatos <[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!
self.pending_table_handle_drops_tx | ||
.send(dropped_id) | ||
.expect("ourselves are not dropped"); | ||
if !self.pending_table_handle_drops_rx.is_empty() { |
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.
👏
// Take the allocation so that we can call mut receiver functions in the loop. We put it | ||
// back at the end of the loop. | ||
let mut stashed_responses = std::mem::take(&mut self.stashed_responses); |
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 we shouldn't? If we drop the allocation instead, we don't have to worry about it ever getting large. Keeping it lets us safe some allocation overhead, but is that really relevant in this code?
updated_frontiers = Some(Response::FrontierUpdates(updates)); | ||
StorageResponse::FrontierUpper(id, upper) => { | ||
let update = (id, upper); | ||
self.update_write_frontiers(std::slice::from_ref(&update)); |
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.
Looks like Controller::update_write_frontiers
is now only called with a single update everywhere, so you could rename it to update_write_frontier
and remove its loop.
/// A list of statistics updates, currently only for sources. | ||
StatisticsUpdates(Vec<SourceStatisticsUpdate>, Vec<SinkStatisticsUpdate>), | ||
/// A list of status updates for sources and sinks. Periodically sent from | ||
/// A status updates for a source or a sink. Periodically sent from |
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.
/// A status updates for a source or a sink. Periodically sent from | |
/// A status update for a source or a sink. Periodically sent from |
@@ -146,7 +145,7 @@ impl<T> StorageCommand<T> { | |||
| InitializationComplete | |||
| AllowWrites | |||
| UpdateConfiguration(_) | |||
| AllowCompaction(_) => false, | |||
| AllowCompaction(_, _) => false, |
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.
Did you know you can use ..
on tuple variants too? Not important at all, but I found this neat when I learned about it :)
Motivation
Tips for reviewer
Each commit flattens one variant
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.