-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: adding component start(initialization) to the server start #447
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #447 +/- ##
==========================================
- Coverage 82.89% 82.80% -0.10%
==========================================
Files 37 37
Lines 1719 1733 +14
Branches 1719 1733 +14
==========================================
+ Hits 1425 1435 +10
- Misses 217 219 +2
- Partials 77 79 +2 ☔ View full report in Codecov by Sentry. |
2a9c292
to
2385f67
Compare
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.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @lev-starkware)
crates/mempool_infra/src/component_runner.rs
line 18 at r1 (raw file):
Ok(()) } }
The naming here slightly confuses me: a runner
has a start
function; wouldn't it be clearer if the function's name would be run
?
Code quote:
pub trait ComponentRunner {
/// Start the component. By default do nothing.
async fn start(&mut self) -> Result<(), ComponentStartError> {
Ok(())
}
}
crates/mempool_infra/tests/common/mod.rs
line 4 at r1 (raw file):
use serde::{Deserialize, Serialize}; use starknet_mempool_infra::component_client::ClientResult; use starknet_mempool_infra::component_runner::ComponentRunner;
Please add an empty line between the last use
and the first type
def.
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.
Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @lev-starkware)
crates/mempool_infra/src/component_server.rs
line 66 at r1 (raw file):
return; } }
Can we unify some of this logic with the impl in the empty server
?
Code quote:
match self.component.start().await {
Ok(_) => info!("ComponentServer::start() completed."),
Err(err) => {
error!("ComponentServer::start() failed: {:?}", err);
return;
}
}
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.
Reviewable status: 0 of 4 files reviewed, 4 unresolved discussions (waiting on @lev-starkware)
crates/mempool_infra/src/component_runner.rs
line 18 at r1 (raw file):
Ok(()) } }
I'm also in favor of having better consistency with the ComponentServerStarter
: here the start
function returns Result
, in the server starter it doesn't return anything.
Is there a way to address that (can be in a different pr)?
Code quote:
pub trait ComponentRunner {
/// Start the component. By default do nothing.
async fn start(&mut self) -> Result<(), ComponentStartError> {
Ok(())
}
}
commit-id:77f186d4
2385f67
to
a35a991
Compare
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.
Reviewable status: 0 of 4 files reviewed, 4 unresolved discussions (waiting on @Itay-Tsabary-Starkware)
crates/mempool_infra/src/component_runner.rs
line 18 at r1 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
I'm also in favor of having better consistency with the
ComponentServerStarter
: here thestart
function returnsResult
, in the server starter it doesn't return anything.Is there a way to address that (can be in a different pr)?
I agree, but let's address it in a different PR.
crates/mempool_infra/src/component_runner.rs
line 18 at r1 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
The naming here slightly confuses me: a
runner
has astart
function; wouldn't it be clearer if the function's name would berun
?
Changed to ComponentStarter
.
crates/mempool_infra/tests/common/mod.rs
line 4 at r1 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Please add an empty line between the last
use
and the firsttype
def.
Done.
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.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @Itay-Tsabary-Starkware)
crates/mempool_infra/src/component_server.rs
line 66 at r1 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Can we unify some of this logic with the impl in the
empty server
?
Done.
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.
Reviewed 2 of 5 files at r2.
Reviewable status: 2 of 5 files reviewed, 2 unresolved discussions (waiting on @lev-starkware)
crates/mempool_infra/src/component_server.rs
line 73 at r2 (raw file):
} pub async fn start_component<Component>(component: &mut Component) -> bool
Please return Result
.
Code quote:
bool
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.
Reviewed 3 of 5 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)
commit-id:77f186d4
This change is