-
Notifications
You must be signed in to change notification settings - Fork 13
SagaDagIterator could/should implement ExactSizeIterator #164
Copy link
Copy link
Open
Description
Context: oxidecomputer/omicron#3895 (comment)
Current Implementation:
Lines 387 to 405 in 77d8f20
| impl<'a> Iterator for SagaDagIterator<'a> { | |
| type Item = NodeEntry<'a>; | |
| fn next(&mut self) -> Option<Self::Item> { | |
| while let Some(node) = self.dag.get(self.index) { | |
| let index = self.index; | |
| self.index = NodeIndex::new(self.index.index() + 1); | |
| match node { | |
| InternalNode::Action { .. } | |
| | InternalNode::Constant { .. } | |
| | InternalNode::SubsagaEnd { .. } => { | |
| return Some(NodeEntry { internal: node, index }) | |
| } | |
| _ => (), | |
| } | |
| } | |
| None | |
| } | |
| } |
Advantages of doing this:
- It would be easier to iterate over the nodes under saga idempotency tests
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.