Turn the CandidateSet and AddressBook into tower Services #1976
Labels
A-rust
Area: Updates to Rust code
C-cleanup
Category: This is a cleanup
C-design
Category: Software design work
S-needs-design
Status: Needs a design decision
Is your feature request related to a problem? Please describe.
In Zebra, we use tower Services for most of our internal APIs.
The AddressBook and CandidateSet act like services, but they are actually custom structs with their own APIs. This makes Zebra harder to maintain and debug.
Describe the solution you'd like
Arc<Mutex<_>>
CandidateSet::next
rate-limit to the outbound handshaker, using atower::RateLimitLayer
CandidateSet::update
requests within the update time limitAttemptPending
before their addresses are returnedDescribe alternatives you've considered
We could do nothing, and Zebra will continue to work well.
We could use a futures-aware mutex for the address book: https://docs.rs/futures/0.3.13/futures/lock/struct.Mutex.html
Additional context
We're still working on a bunch of security fixes that will change the APIs for these services.
This change risks re-introducing deadlocks and livelocks, so it needs to have tests for various edge cases.
The text was updated successfully, but these errors were encountered: