use crate::types::ProtocolName;
use bytes::Bytes;
use libp2p::{
kad::{record::Key, PeerRecord},
PeerId,
};
use sc_network_common::role::ObservedRole;
#[derive(Debug, Clone)]
#[must_use]
pub enum DhtEvent {
ValueFound(PeerRecord),
ValueNotFound(Key),
ValuePut(Key),
ValuePutFailed(Key),
PutRecordRequest(Key, Vec<u8>, Option<sc_network_types::PeerId>, Option<std::time::Instant>),
}
#[derive(Debug, Clone)]
#[must_use]
pub enum Event {
Dht(DhtEvent),
NotificationStreamOpened {
remote: PeerId,
protocol: ProtocolName,
negotiated_fallback: Option<ProtocolName>,
role: ObservedRole,
received_handshake: Vec<u8>,
},
NotificationStreamClosed {
remote: PeerId,
protocol: ProtocolName,
},
NotificationsReceived {
remote: PeerId,
messages: Vec<(ProtocolName, Bytes)>,
},
}