use std::{future::Future, sync::Arc};
use bytes::Bytes;
use nodecraft::{CheapClone, Id};
use crate::proto::NodeState;
#[auto_impl::auto_impl(Box, Arc)]
pub trait PingDelegate: Send + Sync + 'static {
type Id: Id;
type Address: CheapClone + Send + Sync + 'static;
fn ack_payload(&self) -> impl Future<Output = Bytes> + Send;
fn notify_ping_complete(
&self,
node: Arc<NodeState<Self::Id, Self::Address>>,
rtt: std::time::Duration,
payload: Bytes,
) -> impl Future<Output = ()> + Send;
fn disable_reliable_pings(&self, _target: &Self::Id) -> bool {
false
}
}