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