use crate::message::FrameBatch;
use crate::{Blob, ZmqError};
use bytes::Bytes;
use std::time::Duration;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NetAction {
Send { data: Bytes, zc_eligible: bool },
SetCork(bool),
ScheduleClose(Option<Duration>),
}
#[derive(Debug, Clone)]
pub enum AppAction {
HandshakeComplete {
peer_identity: Option<Blob>,
peer_socket_type: Option<String>,
},
DeliverMessage(FrameBatch),
PeerError(ZmqError),
}
#[derive(Debug, Default, Clone)]
pub struct EngineOutput {
pub net_actions: Vec<NetAction>,
pub app_actions: Vec<AppAction>,
}
impl EngineOutput {
pub fn new() -> Self {
Self::default()
}
pub fn with_net(mut self, action: NetAction) -> Self {
self.net_actions.push(action);
self
}
pub fn with_app(mut self, action: AppAction) -> Self {
self.app_actions.push(action);
self
}
}