diff --git a/src/runtime2/consensus.rs b/src/runtime2/consensus.rs index daea21188bf15d535f184b8faa1c08a3af865ae8..951045671b8adc3c3eb5901f27538ad6d3c881a7 100644 --- a/src/runtime2/consensus.rs +++ b/src/runtime2/consensus.rs @@ -144,6 +144,25 @@ impl Consensus { self.branch_markers.push(new_branch_id); } + /// Notifies the consensus algorithm that a particular branch has + /// encountered an unrecoverable error. If the return value is `false`, then + /// the caller can enter a "normal" exit mode instead of the special "sync" + /// exit mode. + pub fn notify_of_fatal_branch(&mut self, failed_branch_id: BranchId) -> bool { + debug_assert!(self.is_in_sync()); + + // Check for trivial case, where branch has not yet communicated within + // the consensus algorithm + let branch = &self.branch_annotations[failed_branch_id.index as usize]; + if branch.port_mapping.iter().all(|v| v.registered_id.is_none()) { + return false; + } + + // Branch has communicated. Since we need to discover the entire + + return true; + } + /// Notifies the consensus algorithm that a branch has reached the end of /// the sync block. A final check for consistency will be performed that the /// caller has to handle. Note that