MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / term_at

Method term_at

nodedb-raft/src/log.rs:59–70  ·  view source on GitHub ↗

Get the term at a given index.

(&self, index: u64)

Source from the content-addressed store, hash-verified

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> {

Callers 4

send_append_entriesMethod · 0.80
handle_append_entriesMethod · 0.80

Calls 1

entry_atMethod · 0.80

Tested by

no test coverage detected