use std::fmt;
use std::time::Duration;
use crate::pal::error::PalError;
use crate::pal::ids::{ConnId, ListenerId};
use crate::protocol::Message;
#[cfg_attr(test, mockall::automock)]
pub(crate) trait Transport: Send + Sync + fmt::Debug + 'static {
fn listen(&self, name: &str) -> Result<ListenerId, PalError>;
fn accept(&self, listener: ListenerId) -> Result<ConnId, PalError>;
fn accept_timeout(&self, listener: ListenerId, timeout: Duration) -> Result<ConnId, PalError>;
fn connect(&self, name: &str, timeout: Duration) -> Result<ConnId, PalError>;
fn send(&self, conn: ConnId, message: &Message) -> Result<(), PalError>;
fn recv(&self, conn: ConnId) -> Result<Message, PalError>;
fn recv_timeout(&self, conn: ConnId, timeout: Duration) -> Result<Message, PalError>;
fn disconnect(&self, conn: ConnId);
fn close_listener(&self, listener: ListenerId);
fn pipe_name(&self, nonce: &str) -> String;
}