diff --git a/src/runtime2/inbox.rs b/src/runtime2/inbox.rs index c489561f96788af0e87b555f3c16628822032599..f5bc869b78ce3cc081b673b240a2d3fb2847d24f 100644 --- a/src/runtime2/inbox.rs +++ b/src/runtime2/inbox.rs @@ -58,34 +58,13 @@ pub(crate) struct DataHeader { pub new_mapping: BranchMarker, } -// TODO: Very much on the fence about this. On one hand I thought making it a -// data message was neat because "silent port notification" should be rerouted -// like any other data message to determine the component ID of the receiver -// and to make it part of the leader election algorithm for the sync leader. -// However: it complicates logic quite a bit. Really it might be easier to -// create `Message::SyncAtComponent` and `Message::SyncAtPort` messages... -#[derive(Debug, Clone)] -pub(crate) enum DataContent { - SilentPortNotification, - Message(ValueGroup), -} - -impl DataContent { - pub(crate) fn as_message(&self) -> Option<&ValueGroup> { - match self { - DataContent::SilentPortNotification => None, - DataContent::Message(message) => Some(message), - } - } -} - /// A data message is a message that is intended for the receiver's PDL code, /// but will also be handled by the consensus algorithm #[derive(Debug, Clone)] pub(crate) struct DataMessage { pub sync_header: SyncHeader, pub data_header: DataHeader, - pub content: DataContent, + pub content: ValueGroup, } #[derive(Debug)] @@ -111,6 +90,7 @@ pub(crate) struct SyncCompMessage { #[derive(Debug)] pub(crate) enum SyncPortContent { + SilentPortNotification, NotificationWave, } @@ -153,10 +133,11 @@ impl Message { /// returns the port through which the message was sent. pub(crate) fn source_port(&self) -> Option { // Currently only data messages have a source port - if let Message::Data(message) = self { - return Some(message.data_header.sending_port); - } else { - return None; + match self { + Message::Data(message) => return Some(message.data_header.sending_port), + Message::SyncPort(message) => return Some(message.source_port), + Message::SyncComp(_) => return None, + Message::Control(_) => return None, } } }