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

Method deserialize

src/models/serializer/inverted/atomic_array.rs:39–69  ·  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

37 }
38
39 fn deserialize(
40 dim_bufman: &BufferManager,
41 data_bufmans: &BufferManagerFactory<VersionNumber>,
42 file_offset: FileOffset,
43 version: VersionNumber,
44 cache: &InvertedIndexCache,
45 ) -> Result<Self, BufIoError> {
46 let cursor = dim_bufman.open_cursor()?;
47
48 let placeholder_offset = file_offset.0 as u64;
49 let array = Self::new();
50
51 for i in 0..N {
52 dim_bufman.seek_with_cursor(cursor, placeholder_offset + (i as u64 * 4))?;
53 let offset = dim_bufman.read_u32_with_cursor(cursor)?;
54 if offset == u32::MAX {
55 continue;
56 }
57 let item = Box::into_raw(Box::new(InvertedIndexSerialize::deserialize(
58 dim_bufman,
59 data_bufmans,
60 FileOffset(offset),
61 version,
62 cache,
63 )?));
64 array.insert(i, item);
65 }
66
67 dim_bufman.close_cursor(cursor)?;
68 Ok(array)
69 }
70}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected