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

Function append_and_retrieve

nodedb-raft/src/log.rs:194–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192
193 #[test]
194 fn append_and_retrieve() {
195 let mut log = RaftLog::new(MemStorage::new());
196 log.append(make_entry(1, 1)).unwrap();
197 log.append(make_entry(1, 2)).unwrap();
198 log.append(make_entry(2, 3)).unwrap();
199
200 assert_eq!(log.last_index(), 3);
201 assert_eq!(log.last_term(), 2);
202 assert_eq!(log.term_at(1), Some(1));
203 assert_eq!(log.term_at(3), Some(2));
204 assert!(log.entry_at(4).is_none());
205 }
206
207 #[test]
208 fn entries_range() {

Callers

nothing calls this directly

Calls 2

make_entryFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected