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

Function mem_storage_compact

nodedb-raft/src/storage.rs:140–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138
139 #[test]
140 fn mem_storage_compact() {
141 let mut s = MemStorage::new();
142 for i in 1..=10 {
143 s.append(&[LogEntry {
144 term: 1,
145 index: i,
146 data: vec![],
147 }])
148 .unwrap();
149 }
150 s.compact(5, 1).unwrap();
151 assert_eq!(s.snapshot_metadata(), (5, 1));
152 let loaded = s.load_entries_after(5).unwrap();
153 assert_eq!(loaded.len(), 5);
154 assert_eq!(loaded[0].index, 6);
155 }
156
157 #[test]
158 fn mem_storage_hard_state() {

Callers

nothing calls this directly

Calls 3

appendMethod · 0.45
compactMethod · 0.45
load_entries_afterMethod · 0.45

Tested by

no test coverage detected