-
Notifications
You must be signed in to change notification settings - Fork 28
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
Adds gossippub/mdns to swarm behaviour for peering and topic subscriptions/publishings #31
Conversation
…tions/publishings. Includes: * updates around db receipts * moves to libp2p master (which has a ton of changes in the pipe) * tokio for all runtime/swarming * direct floodsub capability too (if not trying to force mesh mechanics) * updates outdated libs
c8d6522
to
98b00ad
Compare
Codecov Report
@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 10.17% 12.10% +1.93%
==========================================
Files 14 16 +2
Lines 4050 3642 -408
Branches 2056 1908 -148
==========================================
+ Hits 412 441 +29
+ Misses 3060 2639 -421
+ Partials 578 562 -16
|
let link: Link<Closure> = Closure::try_into(closure)?; | ||
let closure_cid = link | ||
.to_string_of_base(Base::Base32HexLower) | ||
.expect("string CID"); |
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 have no problem with this being reworked, but could you explain a bit about what the advantage of allocating another binding here is? I don't see link
used anywhere else 🤔
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 broke this from your original code, as I was running up the "demo" in its entirety now. Cid (from the multiformat library) will throw an error on try_into
(when given closure_bytes
) as it can't decipher the version. This is to get the cid that we need.
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.
But, something I'd like to re-explore in how it's derived.
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 is leveraging the free "into" that comes from TryFrom here in closure.rs:
impl TryFrom<Closure> for Link<Closure> {
type Error = anyhow::Error;
fn try_from(closure: Closure) -> Result<Link<Closure>, Self::Error> {
let ipld: Ipld = closure.into();
let bytes = DagCborCodec.encode(&ipld)?;
Ok(Link::new(Cid::new_v1(
DagCborCodec.into(),
Code::Sha3_256.digest(&bytes),
)))
}
}
Description
Includes:
Closes #27 for now.