use crate::types::ProtocolName;
use bytes::Bytes;
use sc_network_common::role::ObservedRole;
use sc_network_types::{
kad::{Key, PeerRecord},
multiaddr::Multiaddr,
PeerId,
};
#[derive(Debug, Clone)]
#[must_use]
pub enum DhtEvent {
ClosestPeersFound(PeerId, Vec<(PeerId, Vec<Multiaddr>)>),
ClosestPeersNotFound(PeerId),
ValueFound(PeerRecord),
ValueNotFound(Key),
ValuePut(Key),
ValuePutFailed(Key),
StartedProviding(Key),
StartProvidingFailed(Key),
PutRecordRequest(Key, Vec<u8>, Option<PeerId>, Option<std::time::Instant>),
ProvidersFound(Key, Vec<PeerId>),
NoMoreProviders(Key),
ProvidersNotFound(Key),
}
#[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)>,
},
}