(
bufman: &BufferManager,
latest_version_links_bufman: &FilelessBufferManager,
file_index: FileIndex<IndexFileId>,
cache: &HNSWIndexCache,
max_loads: u16,
| 101 | } |
| 102 | |
| 103 | fn deserialize( |
| 104 | bufman: &BufferManager, |
| 105 | latest_version_links_bufman: &FilelessBufferManager, |
| 106 | file_index: FileIndex<IndexFileId>, |
| 107 | cache: &HNSWIndexCache, |
| 108 | max_loads: u16, |
| 109 | skipm: &mut FxHashSet<u64>, |
| 110 | ) -> Result<Self, BufIoError> { |
| 111 | let cursor = bufman.open_cursor()?; |
| 112 | let offset = file_index.offset.0; |
| 113 | bufman.seek_with_cursor(cursor, offset as u64)?; |
| 114 | // Read basic fields |
| 115 | let hnsw_level = HNSWLevel(bufman.read_u8_with_cursor(cursor)?); |
| 116 | let version = VersionNumber::from(bufman.read_u32_with_cursor(cursor)?); |
| 117 | // Read prop_value |
| 118 | let prop_offset = FileOffset(bufman.read_u32_with_cursor(cursor)?); |
| 119 | let prop_length = BytesToRead(bufman.read_u32_with_cursor(cursor)?); |
| 120 | let prop = cache.get_prop(prop_offset, prop_length)?; |
| 121 | |
| 122 | // Read prop_metadata |
| 123 | let metadata_offset = bufman.read_u32_with_cursor(cursor)?; |
| 124 | let metadata_length = bufman.read_u32_with_cursor(cursor)?; |
| 125 | let metadata = if metadata_offset != u32::MAX { |
| 126 | Some( |
| 127 | cache |
| 128 | .get_prop_metadata(FileOffset(metadata_offset), BytesToRead(metadata_length))?, |
| 129 | ) |
| 130 | } else { |
| 131 | None |
| 132 | }; |
| 133 | |
| 134 | let parent_offset = FileOffset(bufman.read_u32_with_cursor(cursor)?); |
| 135 | let child_offset = FileOffset(bufman.read_u32_with_cursor(cursor)?); |
| 136 | |
| 137 | bufman.close_cursor(cursor)?; |
| 138 | |
| 139 | // Deserialize parent |
| 140 | let parent_file_index = FileIndex { |
| 141 | file_id: IndexFileId::invalid(), |
| 142 | offset: parent_offset, |
| 143 | }; |
| 144 | let parent = SharedLatestNode::deserialize( |
| 145 | bufman, |
| 146 | latest_version_links_bufman, |
| 147 | parent_file_index, |
| 148 | cache, |
| 149 | max_loads, |
| 150 | skipm, |
| 151 | )?; |
| 152 | // Deserialize child |
| 153 | let child_file_index = FileIndex { |
| 154 | file_id: IndexFileId::invalid(), |
| 155 | offset: child_offset, |
| 156 | }; |
| 157 | let child = SharedLatestNode::deserialize( |
| 158 | bufman, |
| 159 | latest_version_links_bufman, |
| 160 | child_file_index, |
nothing calls this directly
no test coverage detected