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

Function flat_slices

nodedb-vector/src/mmap_segment/reader.rs:509–521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508 #[test]
509 fn flat_slices() {
510 let dir = tempfile::tempdir().unwrap();
511 let path = dir.path().join("flat.vseg");
512
513 let v0 = vec![1.0f32, 2.0, 3.0];
514 let v1 = vec![4.0f32, 5.0, 6.0];
515 let sids = vec![100u64, 200];
516
517 let seg = MmapVectorSegment::create_with_surrogates(&path, 3, &[&v0, &v1], &sids).unwrap();
518
519 assert_eq!(seg.all_vectors_flat(), &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);
520 assert_eq!(seg.all_surrogate_ids(), &[100u64, 200]);
521 }
522
523 #[test]
524 fn reopen_roundtrip() {

Callers

nothing calls this directly

Calls 2

joinMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected