diff --git a/src/runtime2/communication.rs b/src/runtime2/communication.rs index f563446fba8df70db1e867ae1f42ab2d0d0c9b80..335f4c6d0864416a0135f0c9522eb433f19f3328 100644 --- a/src/runtime2/communication.rs +++ b/src/runtime2/communication.rs @@ -17,29 +17,6 @@ impl PortId { } } -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum PortKind { - Putter, - Getter, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum PortState { - Open, - BlockedDueToPeerChange, - BlockedDueToFullBuffers, - Closed, -} - -impl PortState { - pub fn is_blocked(&self) -> bool { - match self { - PortState::BlockedDueToPeerChange | PortState::BlockedDueToFullBuffers => true, - PortState::Open | PortState::Closed => false, - } - } -} - pub struct Channel { pub putter_id: PortId, pub getter_id: PortId, @@ -173,19 +150,20 @@ pub struct ControlMessage { pub content: ControlMessageContent, } +/// Content of a control message. If the content refers to a port then the +/// `target_port_id` field is the one that it refers to. #[derive(Copy, Clone, Debug)] pub enum ControlMessageContent { Ack, - BlockPort(PortId), - UnblockPort(PortId), + BlockPort, + UnblockPort, ClosePort(ControlMessageClosePort), - PortPeerChangedBlock(PortId), - PortPeerChangedUnblock(PortId, CompId), + PortPeerChangedBlock, + PortPeerChangedUnblock(PortId, CompId), // contains (new_port_id, new_component_id) } #[derive(Copy, Clone, Debug)] pub struct ControlMessageClosePort { - pub port_to_close: PortId, // ID of the receiving port pub closed_in_sync_round: bool, // needed to ensure correct handling of errors }