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

Method entry_at

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

Get entry at a given index.

(&self, index: u64)

Source from the content-addressed store, hash-verified

71
72 /// Get entry at a given index.
73 pub fn entry_at(&self, index: u64) -> Option<&LogEntry> {
74 if index <= self.snapshot_index || index > self.last_index() {
75 return None;
76 }
77 let offset = (index - self.snapshot_index - 1) as usize;
78 self.entries.get(offset)
79 }
80
81 /// Get entries in range [lo, hi] inclusive.
82 pub fn entries_range(&self, lo: u64, hi: u64) -> Result<&[LogEntry]> {

Callers 2

term_atMethod · 0.80
append_entriesMethod · 0.80

Calls 2

last_indexMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected