use tokio::sync::broadcast;
use super::{Event, Modes};
use crate::{BoxFuture, Error, Result, observation, request, turn};
pub trait Driver: Send + Sync {
fn subscribe(&self) -> broadcast::Receiver<Event>;
fn subscribe_records(&self) -> Result<broadcast::Receiver<observation::Record>> {
Err(Error::Unsupported {
operation: "subscribe_records",
})
}
fn observation_capabilities(&self) -> Result<observation::Capabilities> {
Err(Error::Unsupported {
operation: "observation_capabilities",
})
}
fn snapshot(&self) -> BoxFuture<'_, Result<observation::Snapshot>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "snapshot",
})
})
}
fn stop_agent<'a>(
&'a self,
_id: &'a str,
) -> BoxFuture<'a, Result<crate::observation::control::Receipt>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "stop_agent",
})
})
}
fn stop_task<'a>(
&'a self,
_id: &'a str,
) -> BoxFuture<'a, Result<crate::observation::control::Receipt>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "stop_task",
})
})
}
fn task_output<'a>(
&'a self,
_id: &'a str,
_query: crate::observation::task::OutputQuery,
) -> BoxFuture<'a, Result<crate::observation::task::OutputPage>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "task_output",
})
})
}
fn send(&self, input: turn::Input) -> BoxFuture<'_, Result<turn::Receipt>>;
fn interrupt<'a>(&'a self, turn_id: &'a str) -> BoxFuture<'a, Result<()>>;
fn respond<'a>(
&'a self,
_request_id: &'a str,
_decision: request::Decision,
) -> BoxFuture<'a, Result<()>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "respond",
})
})
}
fn set_permissions(
&self,
_configuration: crate::permission::Configuration,
) -> BoxFuture<'_, Result<()>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "set_permissions",
})
})
}
fn modes(&self) -> Result<Modes> {
Err(Error::Unsupported { operation: "modes" })
}
fn set_mode<'a>(&'a self, _mode_id: &'a str) -> BoxFuture<'a, Result<()>> {
Box::pin(async {
Err(Error::Unsupported {
operation: "set_mode",
})
})
}
fn close(&self) -> BoxFuture<'_, Result<()>>;
}