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

Method deserialize

src/models/serializer/inverted/data.rs:40–71  ·  view source on GitHub ↗
(
        dim_bufman: &BufferManager,
        data_bufmans: &BufferManagerFactory<VersionNumber>,
        file_offset: FileOffset,
        _version: VersionNumber,
        cache: &InvertedIndexCache,

Source from the content-addressed store, hash-verified

38 }
39
40 fn deserialize(
41 dim_bufman: &BufferManager,
42 data_bufmans: &BufferManagerFactory<VersionNumber>,
43 file_offset: FileOffset,
44 _version: VersionNumber,
45 cache: &InvertedIndexCache,
46 ) -> Result<Self, BufIoError> {
47 let cursor = dim_bufman.open_cursor()?;
48 dim_bufman.seek_with_cursor(cursor, file_offset.0 as u64 - 1)?;
49 let quantization_and_implicit = dim_bufman.read_u8_with_cursor(cursor)?;
50 let quantization_bits = (quantization_and_implicit << 1) >> 1;
51 let max_key = ((1u32 << quantization_bits) - 1) as u8;
52
53 let map = TSHashTable::new(16);
54 for i in 0..=max_key {
55 let offset = dim_bufman.read_u32_with_cursor(cursor)?;
56 let version = dim_bufman.read_u32_with_cursor(cursor)?;
57 if offset == u32::MAX {
58 continue;
59 }
60 let pool = VersionedVec::deserialize(
61 dim_bufman,
62 data_bufmans,
63 FileOffset(offset),
64 VersionNumber::from(version),
65 cache,
66 )?;
67 map.insert(i, pool);
68 }
69 dim_bufman.close_cursor(cursor)?;
70 Ok(Self { map, max_key })
71 }
72}

Callers

nothing calls this directly

Calls 7

FileOffsetClass · 0.85
open_cursorMethod · 0.80
seek_with_cursorMethod · 0.80
read_u8_with_cursorMethod · 0.80
read_u32_with_cursorMethod · 0.80
close_cursorMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected