diff --git a/src/runtime2/inbox.rs b/src/runtime2/inbox.rs index f5bc869b78ce3cc081b673b240a2d3fb2847d24f..6e5854c85dd7b27d7967b48bc2baa1f472bc0aeb 100644 --- a/src/runtime2/inbox.rs +++ b/src/runtime2/inbox.rs @@ -94,6 +94,10 @@ pub(crate) enum SyncPortContent { NotificationWave, } +/// A sync message intended for the consensus algorithm. This message does not +/// go to a component, but through a channel (and results in potential +/// rerouting) because we're not sure about the ID of the component that holds +/// the other end of the channel. #[derive(Debug)] pub(crate) struct SyncPortMessage { pub sync_header: SyncHeader, @@ -102,6 +106,24 @@ pub(crate) struct SyncPortMessage { pub content: SyncPortContent, } +#[derive(Debug)] +pub(crate) enum SyncControlContent { + ChannelIsClosed(PortIdLocal), // contains port that is owned by the recipient of the message +} + +/// A sync control message: originating from the scheduler, but intended for the +/// current sync round of the recipient. Every kind of consensus algorithm must +/// be able to handle such a message. +#[derive(Debug)] +pub(crate) struct SyncControlMessage { + // For now these control messages are only aimed at components. Might change + // in the future. But for now we respond to messages from components that + // have, because of that message, published their ID. + pub in_response_to_sync_round: u32, + pub target_component_id: ConnectorId, + pub content: SyncControlContent, +} + /// A control message is a message intended for the scheduler that is executing /// a component. #[derive(Debug)] @@ -125,6 +147,7 @@ pub(crate) enum Message { Data(DataMessage), SyncComp(SyncCompMessage), SyncPort(SyncPortMessage), + SyncControl(SyncControlMessage), Control(ControlMessage), } @@ -137,6 +160,7 @@ impl Message { Message::Data(message) => return Some(message.data_header.sending_port), Message::SyncPort(message) => return Some(message.source_port), Message::SyncComp(_) => return None, + Message::SyncControl(_) => return None, Message::Control(_) => return None, } }