Get the term at a given index.
(&self, index: u64)
| 57 | |
| 58 | /// Get the term at a given index. |
| 59 | pub fn term_at(&self, index: u64) -> Option<u64> { |
| 60 | if index == 0 { |
| 61 | return Some(0); |
| 62 | } |
| 63 | if index == self.snapshot_index { |
| 64 | return Some(self.snapshot_term); |
| 65 | } |
| 66 | if index < self.snapshot_index { |
| 67 | return None; // Compacted. |
| 68 | } |
| 69 | self.entry_at(index).map(|e| e.term) |
| 70 | } |
| 71 | |
| 72 | /// Get entry at a given index. |
| 73 | pub fn entry_at(&self, index: u64) -> Option<&LogEntry> { |
no test coverage detected