use crate::{Result, StreamKey};
use async_trait::async_trait;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct NodeAddr(pub String);
impl<T: Into<String>> From<T> for NodeAddr {
fn from(s: T) -> Self {
NodeAddr(s.into())
}
}
#[async_trait]
pub trait ClusterRelay: Send + Sync + 'static {
async fn locate(&self, key: &StreamKey) -> Result<Option<NodeAddr>>;
async fn pull(&self, key: &StreamKey, origin: &NodeAddr) -> Result<()>;
async fn announce(&self, key: &StreamKey) -> Result<()>;
async fn withdraw(&self, key: &StreamKey) -> Result<()>;
}