MCPcopy Create free account
hub / github.com/cosdata/cosdata / serialize

Method serialize

src/models/serializer/usv/node.rs:26–89  ·  view source on GitHub ↗
(
        &self,
        dim_bufman: &BufferManager,
        data_bufmans: &BufferManagerFactory<VersionNumber>,
        quantization_bits: u8,
        offset_counter: &AtomicU32,
        cursor: u64,

Source from the content-addressed store, hash-verified

24// 16 * 4 bytes for dimension offsets + | INVERTED_INDEX_DATA_CHUNK_SIZE * 6 + 74
25impl USVIndexSerialize for USVIndexNode {
26 fn serialize(
27 &self,
28 dim_bufman: &BufferManager,
29 data_bufmans: &BufferManagerFactory<VersionNumber>,
30 quantization_bits: u8,
31 offset_counter: &AtomicU32,
32 cursor: u64,
33 ) -> Result<u32, BufIoError> {
34 if !self.is_serialized.swap(true, Ordering::AcqRel) {
35 dim_bufman.seek_with_cursor(cursor, self.file_offset.0 as u64)?;
36 dim_bufman.update_u32_with_cursor(cursor, self.dim_index)?;
37 self.data.serialize(
38 dim_bufman,
39 data_bufmans,
40 quantization_bits,
41 offset_counter,
42 cursor,
43 )?;
44 dim_bufman.seek_with_cursor(
45 cursor,
46 self.file_offset.0 as u64 + USV_INDEX_DATA_CHUNK_SIZE as u64 * 6 + 10,
47 )?;
48 self.children.serialize(
49 dim_bufman,
50 data_bufmans,
51 quantization_bits,
52 offset_counter,
53 cursor,
54 )?;
55 } else if self.is_dirty.swap(false, Ordering::AcqRel) {
56 dim_bufman.seek_with_cursor(cursor, self.file_offset.0 as u64 + 4)?;
57 self.data.serialize(
58 dim_bufman,
59 data_bufmans,
60 quantization_bits,
61 offset_counter,
62 cursor,
63 )?;
64 dim_bufman.seek_with_cursor(
65 cursor,
66 self.file_offset.0 as u64 + USV_INDEX_DATA_CHUNK_SIZE as u64 * 6 + 10,
67 )?;
68 self.children.serialize(
69 dim_bufman,
70 data_bufmans,
71 quantization_bits,
72 offset_counter,
73 cursor,
74 )?;
75 } else {
76 dim_bufman.seek_with_cursor(
77 cursor,
78 self.file_offset.0 as u64 + USV_INDEX_DATA_CHUNK_SIZE as u64 * 6 + 10,
79 )?;
80 self.children.serialize(
81 dim_bufman,
82 data_bufmans,
83 quantization_bits,

Callers

nothing calls this directly

Calls 2

seek_with_cursorMethod · 0.80

Tested by

no test coverage detected