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

Method deserialize

src/models/serializer/tree_map/node.rs:89–124  ·  view source on GitHub ↗
(
        dim_bufman: &BufferManager,
        data_bufmans: &BufferManagerFactory<VersionNumber>,
        file_offset: FileOffset,
        version: VersionNumber,
    )

Source from the content-addressed store, hash-verified

87 }
88
89 fn deserialize(
90 dim_bufman: &BufferManager,
91 data_bufmans: &BufferManagerFactory<VersionNumber>,
92 file_offset: FileOffset,
93 version: VersionNumber,
94 ) -> Result<Self, BufIoError> {
95 let cursor = dim_bufman.open_cursor()?;
96 dim_bufman.seek_with_cursor(cursor, file_offset.0 as u64)?;
97 let node_idx = dim_bufman.read_u16_with_cursor(cursor)?;
98 let children = AtomicArray::new();
99 for i in 0..8 {
100 let child_offset = dim_bufman.read_u32_with_cursor(cursor)?;
101 if child_offset == u32::MAX {
102 continue;
103 }
104 let child =
105 Self::deserialize(dim_bufman, data_bufmans, FileOffset(child_offset), version)?;
106 children.insert(i, Box::into_raw(Box::new(child)));
107 }
108 let quotients_offset = dim_bufman.read_u32_with_cursor(cursor)?;
109 let quotients = QuotientsMap::deserialize(
110 dim_bufman,
111 data_bufmans,
112 FileOffset(quotients_offset),
113 version,
114 )?;
115 dim_bufman.close_cursor(cursor)?;
116
117 Ok(Self {
118 node_idx,
119 offset: RwLock::new(Some(file_offset)),
120 quotients,
121 children,
122 dirty: AtomicBool::new(false),
123 })
124 }
125}
126
127impl<T> TreeMapSerialize for TreeMapVecNode<T> {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected