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

Function conflict_detection

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

Source from the content-addressed store, hash-verified

218
219 #[test]
220 fn conflict_detection() {
221 let mut log = RaftLog::new(MemStorage::new());
222 log.append(make_entry(1, 1)).unwrap();
223 log.append(make_entry(1, 2)).unwrap();
224 log.append(make_entry(1, 3)).unwrap();
225
226 // Leader sends entries starting at index 2 with different term.
227 let new_entries = vec![make_entry(2, 2), make_entry(2, 3), make_entry(2, 4)];
228 log.append_entries(1, &new_entries).unwrap();
229
230 assert_eq!(log.last_index(), 4);
231 assert_eq!(log.term_at(2), Some(2));
232 assert_eq!(log.term_at(3), Some(2));
233 }
234
235 #[test]
236 fn snapshot_compaction() {

Callers

nothing calls this directly

Calls 3

make_entryFunction · 0.70
appendMethod · 0.45
append_entriesMethod · 0.45

Tested by

no test coverage detected