tlpt 0.8.0

A set of protocols for building local-first distributed systems
Documentation
use jmbl::{ops::OpWithTarget, OpSender, stream_format::OpSerializer};
use futures::channel::mpsc::UnboundedSender;

pub(crate) struct DocOpSender{
    pub(crate) data_tx: UnboundedSender<litl::Val>,
    pub(crate) serializer: OpSerializer
}

impl DocOpSender {
    pub(crate) fn new(data_tx: UnboundedSender<litl::Val>) -> Self {
        Self {
            data_tx,
            serializer: OpSerializer::new()
        }
    }
}

impl OpSender for DocOpSender {
    fn send(&mut self, op: OpWithTarget) -> Result<(), String> {
        let partial_op = self.serializer.serialize(&op);
        self.data_tx.unbounded_send(partial_op).map_err(|err| err.to_string())
    }

    fn test_get_past_sent_ops(&mut self) -> Option<Vec<OpWithTarget>> {
        unimplemented!()
    }
}