flarrow_api/message.rs
1use arrow_data::ArrayData;
2use tokio::sync::mpsc::{Receiver, Sender};
3use uuid::Uuid;
4
5use crate::prelude::*;
6
7use uhlc::Timestamp;
8
9/// Header for a dataflow message
10#[derive(Debug, PartialEq, Clone)]
11pub struct Header {
12 /// Timestamp of the message, representing when the message was created by the runtime (sender side)
13 pub timestamp: Timestamp,
14
15 /// Identifier of the message, representing the source node uuid and the IO it's coming from (output, query or queryable)
16 pub source: (Uuid, Uuid),
17}
18
19/// Dataflow message. Cheap to clone
20#[derive(Debug, PartialEq, Clone)]
21pub struct DataflowMessage {
22 pub header: Header,
23 pub data: ArrayData,
24}
25
26/// MPSC Message sender. Can be cloned, cheap to clone
27pub type MessageSender = Sender<DataflowMessage>;
28
29/// MPSC Message receiver. Cannot be cloned
30pub type MessageReceiver = Receiver<DataflowMessage>;