diff --git a/src/runtime2/component/component_context.rs b/src/runtime2/component/component_context.rs index f419c322f5e4d68297549ccc137e412065c5c568..fc49944ad2baeff421181bece2c7b2567731d203 100644 --- a/src/runtime2/component/component_context.rs +++ b/src/runtime2/component/component_context.rs @@ -2,6 +2,16 @@ use crate::runtime2::scheduler::*; use crate::runtime2::runtime::*; use crate::runtime2::communication::*; +use crate::protocol::ExpressionId; + +/// Helper struct to remember when the last operation on the port took place +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum PortInstruction { + None, + NoSource, + SourceLocation(ExpressionId), +} + #[derive(Debug)] pub struct Port { pub self_id: PortId, @@ -9,6 +19,7 @@ pub struct Port { pub peer_port_id: PortId, // eventually consistent pub kind: PortKind, pub state: PortState, + pub last_instruction: PortInstruction, #[cfg(debug_assertions)] pub(crate) associated_with_peer: bool, } @@ -58,6 +69,7 @@ impl CompCtx { kind: PortKind::Putter, state: PortState::Open, peer_comp_id: self.id, + last_instruction: PortInstruction::None, #[cfg(debug_assertions)] associated_with_peer: false, }); self.ports.push(Port{ @@ -66,6 +78,7 @@ impl CompCtx { kind: PortKind::Getter, state: PortState::Open, peer_comp_id: self.id, + last_instruction: PortInstruction::None, #[cfg(debug_assertions)] associated_with_peer: false, }); @@ -77,6 +90,7 @@ impl CompCtx { let self_id = PortId(self.take_port_id()); self.ports.push(Port{ self_id, peer_comp_id, peer_port_id, kind, state, + last_instruction: PortInstruction::None, #[cfg(debug_assertions)] associated_with_peer: false, }); return LocalPortHandle(self_id);