use std::future::Future;
use std::pin::Pin;
use tea_protocol::{EventEnvelope, SessionId, SessionSequence};
use crate::KernelError;
pub type KernelEventFuture<'a> = Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'a>>;
pub trait KernelEventSink: std::fmt::Debug + Send + Sync {
fn last_sequence(&self, _session_id: SessionId) -> Option<SessionSequence> {
None
}
fn emit(&self, event: EventEnvelope) -> KernelEventFuture<'_>;
}
#[derive(Debug, Clone, Copy, Default)]
pub struct DiscardEventSink;
impl KernelEventSink for DiscardEventSink {
fn emit(&self, _event: EventEnvelope) -> KernelEventFuture<'_> {
Box::pin(async { Ok(()) })
}
}