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

Method serialize

src/models/serializer/inverted/node.rs:26–54  ·  view source on GitHub ↗
(
        &self,
        dim_bufman: &BufferManager,
        data_bufmans: &BufferManagerFactory<VersionNumber>,
        cursor: u64,
    )

Source from the content-addressed store, hash-verified

24// 16 * 4 bytes for dimension offsets | qv * 8 + 69
25impl InvertedIndexSerialize for InvertedIndexNode {
26 fn serialize(
27 &self,
28 dim_bufman: &BufferManager,
29 data_bufmans: &BufferManagerFactory<VersionNumber>,
30 cursor: u64,
31 ) -> Result<u32, BufIoError> {
32 if !self.is_serialized.swap(true, Ordering::AcqRel) {
33 dim_bufman.seek_with_cursor(cursor, self.file_offset.0 as u64)?;
34 dim_bufman.update_u32_with_cursor(cursor, self.dim_index)?;
35 let mut quantization_and_implicit = self.quantization_bits;
36 if self.implicit {
37 quantization_and_implicit |= 1u8 << 7;
38 }
39 dim_bufman.update_u8_with_cursor(cursor, quantization_and_implicit)?;
40 self.data.serialize(dim_bufman, data_bufmans, cursor)?;
41 self.children.serialize(dim_bufman, data_bufmans, cursor)?;
42 } else if self.is_dirty.swap(false, Ordering::AcqRel) {
43 dim_bufman.seek_with_cursor(cursor, self.file_offset.0 as u64 + 5)?;
44 self.data.serialize(dim_bufman, data_bufmans, cursor)?;
45 self.children.serialize(dim_bufman, data_bufmans, cursor)?;
46 } else {
47 dim_bufman.seek_with_cursor(
48 cursor,
49 self.file_offset.0 as u64 + 5 + (1u64 << (self.quantization_bits + 2)),
50 )?;
51 self.children.serialize(dim_bufman, data_bufmans, cursor)?;
52 };
53 Ok(self.file_offset.0)
54 }
55
56 fn deserialize(
57 dim_bufman: &BufferManager,

Callers

nothing calls this directly

Calls 3

seek_with_cursorMethod · 0.80
update_u8_with_cursorMethod · 0.80

Tested by

no test coverage detected