use async_trait::async_trait;
use crate::types::Id;
#[derive(Debug, Clone, PartialEq)]
pub struct ServiceHandle {
pub id: Id,
}
impl ServiceHandle {
pub fn new(id: Id) -> Self {
Self { id }
}
}
#[async_trait]
pub trait Create {
type Options;
type Error;
async fn create(&mut self, options: Self::Options) -> Result<ServiceHandle, Self::Error>;
}
#[async_trait]
pub trait Register {
type Options;
type Info;
type Error;
async fn register(&mut self, options: Self::Options) -> Result<Self::Info, Self::Error>;
}
#[async_trait]
pub trait Locate {
type Options;
type Info;
type Error;
async fn locate(&mut self, options: Self::Options) -> Result<Self::Info, Self::Error>;
}
#[async_trait]
pub trait Publish {
type Options;
type Info;
type Error;
async fn publish(&mut self, options: Self::Options) -> Result<Self::Info, Self::Error>;
}
#[async_trait]
pub trait Subscribe {
type Options;
type Streamable;
type Error;
async fn subscribe(&mut self, options: Self::Options) -> Result<Self::Streamable, Self::Error>;
}