protocols/request-response: Remove throttled module (#2236)

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Pierre Krieger
2021-09-25 18:18:06 +02:00
committed by GitHub
parent 3c0f5c7848
commit f030b15be0
6 changed files with 5 additions and 1236 deletions

View File

@ -58,11 +58,9 @@
pub mod codec;
pub mod handler;
pub mod throttled;
pub use codec::{ProtocolName, RequestResponseCodec};
pub use handler::ProtocolSupport;
pub use throttled::Throttled;
use futures::channel::oneshot;
use handler::{RequestProtocol, RequestResponseHandler, RequestResponseHandlerEvent};
@ -248,11 +246,6 @@ impl<TResponse> ResponseChannel<TResponse> {
pub fn is_open(&self) -> bool {
!self.sender.is_canceled()
}
/// Get the ID of the inbound request waiting for a response.
pub(crate) fn request_id(&self) -> RequestId {
self.request_id
}
}
/// The ID of an inbound or outbound request.
@ -369,19 +362,6 @@ where
}
}
/// Creates a `RequestResponse` which limits requests per peer.
///
/// The behaviour is wrapped in [`Throttled`] and detects the limits
/// per peer at runtime which are then enforced.
pub fn throttled<I>(c: TCodec, protos: I, cfg: RequestResponseConfig) -> Throttled<TCodec>
where
I: IntoIterator<Item = (TCodec::Protocol, ProtocolSupport)>,
TCodec: Send,
TCodec::Protocol: Sync,
{
Throttled::new(c, protos, cfg)
}
/// Initiates sending a request.
///
/// If the targeted peer is currently not connected, a dialing