(&mut self)
| 72 | type Item = HistoryResult<HistoryEntry>; |
| 73 | |
| 74 | fn next(&mut self) -> Option<Self::Item> { |
| 75 | // Check limit |
| 76 | if let Some(limit) = self.limit { |
| 77 | if self.count >= limit { |
| 78 | return None; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | // Get next from inner iterator |
| 83 | let result = self.inner.next()?; |
| 84 | |
| 85 | self.count += 1; |
| 86 | |
| 87 | match result { |
| 88 | Ok((seq, node_id, merkle)) => { |
| 89 | // Get the external hash |
| 90 | let hash = match self.txn.get_external(node_id) { |
| 91 | Ok(Some(h)) => h, |
| 92 | Ok(None) => { |
| 93 | return Some(Err(HistoryError::ChangeNotFound { |
| 94 | hash: format!("{:?}", node_id), |
| 95 | })); |
| 96 | } |
| 97 | Err(e) => { |
| 98 | return Some(Err(HistoryError::Database(e.to_string()))); |
| 99 | } |
| 100 | }; |
| 101 | |
| 102 | let entry = HistoryEntry::new(seq, node_id, hash, merkle); |
| 103 | |
| 104 | // Note: Header loading would be done by the Repository layer |
| 105 | // since it requires access to the ChangeStore |
| 106 | |
| 107 | Some(Ok(entry)) |
| 108 | } |
| 109 | Err(e) => Some(Err(HistoryError::Database(e.to_string()))), |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | // Log Functions |
no test coverage detected