-
Notifications
You must be signed in to change notification settings - Fork 39
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
linkd #779
Conversation
c0eef53
to
f3233fe
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.
Just some small things so far, but it's looking like it's coming together :)
21052f1
to
4350741
Compare
linkd-lib/src/args.rs
Outdated
/// Forces the creation of a temporary root for the local state, sould be | ||
/// used for debug and testing only. | ||
#[structopt(long)] | ||
pub tmp_root: 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.
IIUC, setting this to true
will render rad_home
a no-op. Perhaps fold into one argument?
linkd-lib/Cargo.toml
Outdated
futures = "0.3" | ||
lazy_static = "1.4" | ||
log = "0.4" | ||
nix = "0.22" |
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.
Knew I'd bring you around to nix
sooner or later
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.
Not your kind of nix, boy!
linkd-lib/src/args.rs
Outdated
// This file is part of radicle-link, distributed under the GPLv3 with Radicle | ||
// Linking Exception. For full terms see the included LICENSE file. | ||
|
||
// TODO(xla): Expose discovery args. |
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.
Are these all for the follow-up patches of #722?
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.
With our rapid offboarding of this walled garden I'm uncertain where to track follow-up work. Will go over the TODOs and see if they are out-of-sync with the #722.
linkd-lib/src/args.rs
Outdated
impl Default for MetricsArgs { | ||
fn default() -> Self { | ||
Self { | ||
provider: None, |
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.
If the above says required_if("metrics-provider", "graphite")
, wouldn't it make sense that this should be Some(MetricsProvider::Graphite)
since the address is provided below? 🤔
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.
You are right, I haven't found a way to enforce a heuristic a la: only expect X when Y is set.
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.
Ya, I meant the way one would usually do this is by packing it as an enum variant, right?
enum Provider {
Graphite { address: String }
}
but that doesn't fly if we want flattened args, so I guess we're between a rock and a hard place :) I wonder would it make sense to have the graphite_addr
as Option
as well?
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.
Might be I'm holding the Structops wrong but that would conflict with the need to default to the local graphite instance if graphite is set as a metric provider.
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 thinking is that if metrics-provider
is set to "graphite"
then you'll end up with Some(MetricsProvider::Graphite)
and then the address will be Some("localhost:8080")
(or whatever the port is). And on the flip-side, if metrics-provider
is None
then graphite_addr
is also, rightfully, None
.
That being said this is not a big deal, and should not be a blocker :) Just musing about what's the best way to represent the data
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 don't follow how you'd express that with the structopt primitives.
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 suggestion is:
#[derive(Debug, Eq, PartialEq, StructOpt)]
pub struct MetricsArgs {
/// Provider for metrics collection.
#[structopt(long = "metrics-provider", name = "metrics-provider")]
pub provider: Option<MetricsProvider>,
/// Address of the graphite collector to send stats to.
#[structopt(
long,
required_if("metrics-provider", "graphite")
)]
pub graphite_addr: Option<String>,
}
/* then the conversion here */
let metrics = match args.metrics.provider {
Some(args::MetricsProvider::Graphite) => Some(Metrics::Graphite(
args.metrics
.graphite_addr
.unwrap_or("localhost:2003")
.to_socket_addrs()?
.next()
.unwrap(),
)),
None => None,
};
Which is a minor improvement if any. It's just unfortunate that we can't express this better in structopt
.
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.
Nice work =] Looking forward to the new age of daemons
a4ca29a
to
6af39b4
Compare
I would, however, appreciate a slightly more condensed commit history. |
I always squash before merge but leave that to the latest point to account for commits addressing feedback. |
This comes in handy in places where `Network` is used as input for parameterisation and therefore needs to be displayed or otherwise stringly represented. Signed-off-by: Alexander Simmerl <[email protected]>
It expresses the behaviour more correctly as the implementation of new is really about finding a sensible default in the presenece of env vars and other factors. Signed-off-by: Alexander Simmerl <[email protected]>
Will give callers more control over the handling of that error case, the author expects this to be an oversight of the original implementation. Signed-off-by: Alexander Simmerl <[email protected]>
First iterative implementation of RFC 0696 focusing on driving the core peer protocol and establishing the harness for configuration of a running node. Rite of passage for it will be replacement of the ephemeral peer in the e2e networkss, as that requires a well behaved peer with a set of knobs exposed. Structurally the majority of the implementation lives in a library crate node-lib. The code is rather Mario-esque as it is primarily plumbing of code that either existed in other crates backing binaries or newish code doing the same thing for core pieces. There are still large pieces missing, which a tracked in #722 and will be piled on-top as patches to keep this already big delta focused. The declared initial goal is to get linkd into a state where it can run as bootstrap/seed node. Signed-off-by: Alexander Simmerl <[email protected]>
A very thin and light wrapper around the `node::run` exposed from the node lib crate, so `linkd` exists as a deploy target. Bootstrapping a whole new workspace which is excluded from root, allows for a checked in `Cargo.lock` without affecting the lib crates. Historically this used to be the role of radicle-bins. Signed-off-by: Alexander Simmerl <[email protected]>
Now that a binary exists which drives the core protocol and has all the knobs exposed that the e2e network tests want to turn there is no need anymore for the ad-hocish epehmeral peer implementation. This concludes the first chapter of linkd's development as the declared goal of gaining some confidence through at the integration layer for it succeeded. Signed-off-by: Alexander Simmerl <[email protected]>
d98fa79
to
05164e4
Compare
First iterative implementation of RFC 0696 focusing on driving the core
peer protocol and establishing the harness for configuration of a running node.
Rite of passage for it was the replacement of the ephemeral peer in the e2e
networkss, as that required a well behaved peers with a set of knobs exposed.
Structurally the majority implementation lives in a library crate
linkd-lib
-probably the most horrendous crate name in this repo to date - with a newly
created workspace under
bins
and alinkd
crate in wrapping it lightly in amain
. That strategy allows for a checked-inCargo.lock
for binariesassociated with link project. Beyond that the code is rather Mario-esque as it
is primarily plumbing of code that either existed in other crates backing
binaries or newish code doing the same thing for core pieces.
There are still large pieces missing, which a tracked in #722 and will be
piled on-top as patches to keep this already big delta focused. The declared
initial goal is to get
linkd
into a state where it can run as bootstrap/seednode.