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
Introduce faucet
subcommand
#1357
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RolandSherwin
force-pushed
the
faucet-subcmd
branch
from
February 27, 2024 12:15
c36cf90
to
8a4ab69
Compare
RolandSherwin
approved these changes
Feb 27, 2024
A new `faucet` subcommand is introduced, enabling the faucet to be controlled as a service. This is necessary because as with nodes, the faucet also needs to be upgraded on a new deployment; it may also require downgrading in the event of a problem. The existing `faucet` command, which was created as a utility for the backwards compatibility test, is removed; now that we can define the faucet as a service, it will no longer be necessary. The function that determines the data directory for the faucet was being duplicated in two different crates, and the node manager would have added a third, so it was refactored as public in `sn_transfers` and shared from there.
This command is quite similar to the `start` command for starting a node service, but my judgement is there probably isn't enough code that is common between them to extract out something more generic. BREAKING CHANGE: the `faucet_pid` field of the node registry was removed in favour of a `faucet` field, which provides more details, including the PID.
Rather than having a `faucet` module within `node_control`, I thought it made sense to also have a `faucet_control` module, and I've organised it the same as `node_control`.
jacderida
force-pushed
the
faucet-subcmd
branch
2 times, most recently
from
February 27, 2024 15:09
1e2fe67
to
c93dbc1
Compare
/// | ||
/// There are several arguments that probably seem like they could be handled within the function, | ||
/// but they enable more controlled unit testing. | ||
pub async fn add_faucet( |
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 function can be made non-async.
sn_node_manager/src/bin/cli/main.rs
Outdated
let faucet_path = | ||
get_bin_path(build, path, ReleaseType::Faucet, version, &*release_repo).await?; | ||
let mut node_registry = NodeRegistry::load(&get_node_registry_path()?)?; | ||
if let Some(faucet) = node_registry.faucet.clone() { |
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.
Just a tiny nit, but marking the var as mut
can help us remove the following line, let mut faucet = faucet
.
Suggested change
if let Some(faucet) = node_registry.faucet.clone() { | |
if let Some(mut faucet) = node_registry.faucet.clone() { |
jacderida
force-pushed
the
faucet-subcmd
branch
from
February 27, 2024 15:23
c93dbc1
to
13499de
Compare
As with the `faucet start` command, this provides the corresponding `stop` command. I revisited the idea of sharing code between the node and faucet services, but again came to the conclusion that there wasn't much value added for the complexity it introduced. The result is that we have code between them that only has small differences, but I think this is OK for now.
jacderida
force-pushed
the
faucet-subcmd
branch
from
February 27, 2024 15:45
13499de
to
9688583
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
11788e8 feat: provide
faucet add
commandA new
faucet
subcommand is introduced, enabling the faucet to be controlled as a service. This isnecessary because as with nodes, the faucet also needs to be upgraded on a new deployment; it may
also require downgrading in the event of a problem.
The existing
faucet
command, which was created as a utility for the backwards compatibility test,is removed; now that we can define the faucet as a service, it will no longer be necessary.
The function that determines the data directory for the faucet was being duplicated in two different
crates, and the node manager would have added a third, so it was refactored as public in
sn_transfers
and shared from there.a319ebb feat: provide
faucet start
commandThis command is quite similar to the
start
command for starting a node service, but my judgementis there probably isn't enough code that is common between them to extract out something more
generic.
BREAKING CHANGE: the
faucet_pid
field of the node registry was removed in favour of afaucet
field, which provides more details, including the PID.
5e3b93c refactor: create a
faucet_control
moduleRather than having a
faucet
module withinnode_control
, I thought it made sense to also have afaucet_control
module, and I've organised it the same asnode_control
.3a2a965 feat: provide
faucet stop
commandAs with the
faucet start
command, this provides the correspondingstop
command. I revisited theidea of sharing code between the node and faucet services, but again came to the conclusion that
there wasn't much value added for the complexity it introduced. The result is that we have code
between them that only has small differences, but I think this is OK for now.
Description
reviewpad:summary