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

Method deserialize

src/models/serializer/usv/atomic_array.rs:49–79  ·  view source on GitHub ↗
(
        dim_bufman: &BufferManager,
        data_bufmans: &BufferManagerFactory<VersionNumber>,
        file_offset: FileOffset,
        version: VersionNumber,
        cache: &USVIndexCache,
    )

Source from the content-addressed store, hash-verified

47 }
48
49 fn deserialize(
50 dim_bufman: &BufferManager,
51 data_bufmans: &BufferManagerFactory<VersionNumber>,
52 file_offset: FileOffset,
53 version: VersionNumber,
54 cache: &USVIndexCache,
55 ) -> Result<Self, BufIoError> {
56 let cursor = dim_bufman.open_cursor()?;
57
58 let placeholder_offset = file_offset.0 as u64;
59 let array = Self::new();
60
61 for i in 0..N {
62 dim_bufman.seek_with_cursor(cursor, placeholder_offset + (i as u64 * 4))?;
63 let offset = dim_bufman.read_u32_with_cursor(cursor)?;
64 if offset == u32::MAX {
65 continue;
66 }
67 let item = Box::into_raw(Box::new(USVIndexSerialize::deserialize(
68 dim_bufman,
69 data_bufmans,
70 FileOffset(offset),
71 version,
72 cache,
73 )?));
74 array.insert(i, item);
75 }
76
77 dim_bufman.close_cursor(cursor)?;
78 Ok(array)
79 }
80}

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