timely_communication/
logging.rs

1//! Configuration and events for communication logging.
2
3/// Configuration information about a communication thread.
4#[derive(Abomonation, Debug, PartialEq, Eq, Hash, Clone, Copy)]
5pub struct CommunicationSetup {
6    /// True when this is a send thread (or the receive thread).
7    pub sender: bool,
8    /// The process id of the thread.
9    pub process: usize,
10    /// The remote process id.
11    pub remote: Option<usize>,
12}
13
14/// Various communication events.
15#[derive(Abomonation, Debug, PartialEq, Eq, Hash, Clone, Copy)]
16pub enum CommunicationEvent {
17    /// An observed message.
18    Message(MessageEvent),
19    /// A state transition.
20    State(StateEvent),
21}
22
23/// An observed message.
24#[derive(Abomonation, Debug, PartialEq, Eq, Hash, Clone, Copy)]
25pub struct MessageEvent {
26    /// true for send event, false for receive event
27    pub is_send: bool,
28    /// associated message header.
29    pub header: crate::networking::MessageHeader,
30}
31
32/// Starting or stopping communication threads.
33#[derive(Abomonation, Debug, PartialEq, Eq, Hash, Clone, Copy)]
34pub struct StateEvent {
35    /// Is the thread a send (vs a recv) thread.
36    pub send: bool,
37    /// The host process id.
38    pub process: usize,
39    /// The remote process id.
40    pub remote: usize,
41    /// Is the thread starting or stopping.
42    pub start: bool,
43}
44
45impl From<MessageEvent> for CommunicationEvent {
46    fn from(v: MessageEvent) -> CommunicationEvent { CommunicationEvent::Message(v) }
47}
48impl From<StateEvent> for CommunicationEvent {
49    fn from(v: StateEvent) -> CommunicationEvent { CommunicationEvent::State(v) }
50}