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

Function import_observes_remote_hlc

nodedb-array/src/sync/schema_crdt.rs:306–320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304
305 #[test]
306 fn import_observes_remote_hlc() {
307 let g_a = generator(1);
308 let schema = simple_schema("x");
309 let doc_a = SchemaDoc::from_schema(replica(1), &schema, &g_a).unwrap();
310 let remote_hlc = doc_a.schema_hlc();
311 let snapshot = doc_a.export_snapshot().unwrap();
312
313 let g_b = generator(2);
314 let mut doc_b = SchemaDoc::new(replica(2));
315 doc_b.import_snapshot(&snapshot, remote_hlc, &g_b).unwrap();
316
317 // After import, any new local write must produce hlc > remote_hlc.
318 doc_b.replace_schema(&simple_schema("x2"), &g_b).unwrap();
319 assert!(doc_b.schema_hlc() > remote_hlc);
320 }
321
322 #[test]
323 fn import_garbage_errors() {

Callers

nothing calls this directly

Calls 7

generatorFunction · 0.85
replace_schemaMethod · 0.80
simple_schemaFunction · 0.70
replicaFunction · 0.70
schema_hlcMethod · 0.45
export_snapshotMethod · 0.45
import_snapshotMethod · 0.45

Tested by

no test coverage detected