diff --git a/src/runtime2/communication.rs b/src/runtime2/communication.rs index 1f5cbaca826bf937a6facc7a952e517388a04e74..0d2fd6149906e06134d68780b528a22d5a1101b9 100644 --- a/src/runtime2/communication.rs +++ b/src/runtime2/communication.rs @@ -78,6 +78,7 @@ pub struct SyncMessage { pub content: SyncMessageContent, } +#[derive(Debug)] pub struct SyncLocalSolutionEntry { pub self_port_id: PortId, pub peer_comp_id: CompId, @@ -88,6 +89,7 @@ pub struct SyncLocalSolutionEntry { pub type SyncLocalSolution = Vec; +#[derive(Debug)] pub struct SyncSolutionPort { pub self_comp_id: CompId, pub self_port_id: PortId, @@ -97,29 +99,37 @@ pub struct SyncSolutionPort { pub port_kind: PortKind, } +#[derive(Debug)] pub struct SyncSolutionChannel { pub putter: Option, pub getter: Option, } -#[derive(Copy, Clone)] -pub enum RoundDecision { +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum SyncRoundDecision { None, Solution, Failure, } -impl RoundDecision { - fn is_some(&self) -} - +#[derive(Debug)] pub struct SyncPartialSolution { pub submissions_by: Vec<(CompId, bool)>, pub channel_mapping: Vec, pub decision: SyncRoundDecision, } -#[derive(Debug, Clone)] +impl Default for SyncPartialSolution { + fn default() -> Self { + return Self{ + submissions_by: Vec::new(), + channel_mapping: Vec::new(), + decision: SyncRoundDecision::None, + } + } +} + +#[derive(Debug)] pub enum SyncMessageContent { NotificationOfLeader, LocalSolution(CompId, SyncLocalSolution), // local solution of the specified component