mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 09:11:34 +00:00
refactor(dcutr): reshape public API to follow naming guidelines (#3214)
With this patch, the naming of types follows the guidelines discussed in #2217.
This commit is contained in:
@ -55,21 +55,21 @@ enum EventType {
|
||||
DirectConnectionUpgradeFailed,
|
||||
}
|
||||
|
||||
impl From<&libp2p_dcutr::behaviour::Event> for EventType {
|
||||
fn from(event: &libp2p_dcutr::behaviour::Event) -> Self {
|
||||
impl From<&libp2p_dcutr::Event> for EventType {
|
||||
fn from(event: &libp2p_dcutr::Event) -> Self {
|
||||
match event {
|
||||
libp2p_dcutr::behaviour::Event::InitiatedDirectConnectionUpgrade {
|
||||
libp2p_dcutr::Event::InitiatedDirectConnectionUpgrade {
|
||||
remote_peer_id: _,
|
||||
local_relayed_addr: _,
|
||||
} => EventType::InitiateDirectConnectionUpgrade,
|
||||
libp2p_dcutr::behaviour::Event::RemoteInitiatedDirectConnectionUpgrade {
|
||||
libp2p_dcutr::Event::RemoteInitiatedDirectConnectionUpgrade {
|
||||
remote_peer_id: _,
|
||||
remote_relayed_addr: _,
|
||||
} => EventType::RemoteInitiatedDirectConnectionUpgrade,
|
||||
libp2p_dcutr::behaviour::Event::DirectConnectionUpgradeSucceeded {
|
||||
remote_peer_id: _,
|
||||
} => EventType::DirectConnectionUpgradeSucceeded,
|
||||
libp2p_dcutr::behaviour::Event::DirectConnectionUpgradeFailed {
|
||||
libp2p_dcutr::Event::DirectConnectionUpgradeSucceeded { remote_peer_id: _ } => {
|
||||
EventType::DirectConnectionUpgradeSucceeded
|
||||
}
|
||||
libp2p_dcutr::Event::DirectConnectionUpgradeFailed {
|
||||
remote_peer_id: _,
|
||||
error: _,
|
||||
} => EventType::DirectConnectionUpgradeFailed,
|
||||
@ -77,8 +77,8 @@ impl From<&libp2p_dcutr::behaviour::Event> for EventType {
|
||||
}
|
||||
}
|
||||
|
||||
impl super::Recorder<libp2p_dcutr::behaviour::Event> for Metrics {
|
||||
fn record(&self, event: &libp2p_dcutr::behaviour::Event) {
|
||||
impl super::Recorder<libp2p_dcutr::Event> for Metrics {
|
||||
fn record(&self, event: &libp2p_dcutr::Event) {
|
||||
self.events
|
||||
.get_or_create(&EventLabels {
|
||||
event: event.into(),
|
||||
|
@ -100,8 +100,8 @@ pub trait Recorder<Event> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "dcutr")]
|
||||
impl Recorder<libp2p_dcutr::behaviour::Event> for Metrics {
|
||||
fn record(&self, event: &libp2p_dcutr::behaviour::Event) {
|
||||
impl Recorder<libp2p_dcutr::Event> for Metrics {
|
||||
fn record(&self, event: &libp2p_dcutr::Event) {
|
||||
self.dcutr.record(event)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user