diff --git a/src/runtime2/component/consensus.rs b/src/runtime2/component/consensus.rs index 666ecf3c637103d1c7646b01252373c244637536..e0241691fdf1da8af32096d323bfbe981f1032a7 100644 --- a/src/runtime2/component/consensus.rs +++ b/src/runtime2/component/consensus.rs @@ -11,16 +11,18 @@ pub struct PortAnnotation { peer_comp_id: CompId, // only valid for getter ports peer_port_id: PortId, // only valid for getter ports mapping: Option, + kind: PortKind, } impl PortAnnotation { - fn new(comp_id: CompId, port_id: PortId) -> Self { + fn new(comp_id: CompId, port_id: PortId, kind: PortKind) -> Self { return Self{ self_comp_id: comp_id, self_port_id: port_id, peer_comp_id: CompId::new_invalid(), peer_port_id: PortId::new_invalid(), - mapping: None + mapping: None, + kind, } } } @@ -347,7 +349,7 @@ impl Consensus { self.ports.clear(); self.ports.reserve(comp_ctx.num_ports()); for port in comp_ctx.iter_ports() { - self.ports.push(PortAnnotation::new(comp_ctx.id, port.self_id)) + self.ports.push(PortAnnotation::new(comp_ctx.id, port.self_id, port.kind)); } } } @@ -593,7 +595,19 @@ impl Consensus { let mut port_index = usize::MAX; for (index, port) in self.ports.iter().enumerate() { if port.self_port_id == port_info.self_id { - port_index = index; + port_index = index; // remember for later updating + } + + let annotation_kind = match port.kind { + PortKind::Putter => PortAnnotationKind::Putter(PortAnnotationPutter{ + self_comp_id: port.self_comp_id, + self_port_id: port.self_port_id + }), + PortKind::Getter => PortAnnotationKind::Getter(PortAnnotationGetter{ + self_comp_id: port.self_comp_id, + self_port_id: port.self_port_id, + peer_comp_id: + }) } expected_mapping.push((port.self_port_id, port.mapping)); }