use crate::*;
use std::sync::Arc;
pub trait KnownPeers: 'static + Send + Sync + std::fmt::Debug {
fn record(
&self,
agent_infos: Vec<Arc<AgentInfoSigned>>,
) -> BoxFut<'_, K2Result<()>>;
fn get_by_url(&self, url: Url) -> BoxFut<'_, K2Result<Vec<AgentId>>>;
}
pub type DynKnownPeers = Arc<dyn KnownPeers>;
pub trait KnownPeersFactory: 'static + Send + Sync + std::fmt::Debug {
fn default_config(&self, config: &mut Config) -> K2Result<()>;
fn validate_config(&self, config: &Config) -> K2Result<()>;
fn create(
&self,
builder: Arc<Builder>,
space_id: SpaceId,
) -> BoxFut<'static, K2Result<DynKnownPeers>>;
}
pub type DynKnownPeersFactory = Arc<dyn KnownPeersFactory>;