feat(SwarmBuilder): make `with_bandwidth_logging` chainable
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
SwarmBuilder::with_bandwidth_logging allows adding a bandwidth logging to a tree of transports constructed via SwarmBuilder. It returns both the builder and the BandwidthSinks. That is not ideal as it breaks the builder chain.
This originally came up in https://github.com/libp2p/rust-libp2p/pull/4120#discussion_r1314340085.
Motivation
A single continuous builder chain is more ergonomic.
Current Implementation
The current with_bandwidth_logging requires a two step builder flow:
See also https://github.com/libp2p/rust-libp2p/pull/4626#discussion_r1355883313.
Are you planning to do it yourself in a pull request ?
No
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in libp2p/src/builder.rs around the with_bandwidth_logging implementation at lines 300-321, and review the linked discussions for the intended builder API. Determine how the method can preserve access to BandwidthSinks without breaking a continuous chain; done means the builder remains chainable and bandwidth logging still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100