MCPcopy Create free account
hub / github.com/antgroup/vsag / Deserialize

Method Deserialize

src/algorithm/inner_index_interface.cpp:177–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void
178InnerIndexInterface::Deserialize(const BinarySet& binary_set) {
179 std::string time_record_name = this->GetName() + " Deserialize";
180 SlowTaskTimer t(time_record_name);
181
182 // new version serialization will contains the META_KEY
183 if (binary_set.Contains(SERIAL_META_KEY)) {
184 logger::debug("parse with new version format");
185 auto metadata = std::make_shared<Metadata>(binary_set.Get(SERIAL_META_KEY));
186
187 if (metadata->EmptyIndex()) {
188 return;
189 }
190 } else {
191 logger::debug("parse with v0.11 version format");
192
193 // check if binary set is an empty index
194 if (binary_set.Contains(BLANK_INDEX)) {
195 return;
196 }
197 }
198
199 Binary b = binary_set.Get(this->GetName());
200 auto func = [&](uint64_t offset, uint64_t len, void* dest) -> void {
201 // logger::debug("read offset {} len {}", offset, len);
202 std::memcpy(dest, b.data.get() + offset, len);
203 };
204
205 try {
206 uint64_t cursor = 0;
207 auto reader = ReadFuncStreamReader(func, cursor, b.size);
208 this->Deserialize(reader);
209 } catch (const std::runtime_error& e) {
210 throw VsagException(ErrorType::READ_ERROR, "failed to Deserialize: ", e.what());
211 }
212}
213
214void
215InnerIndexInterface::Deserialize(const ReaderSet& reader_set) {

Callers 1

CloneMethod · 0.45

Calls 13

SetIOMethod · 0.95
VsagExceptionClass · 0.85
EmptyIndexMethod · 0.80
getMethod · 0.80
debugFunction · 0.50
GetNameMethod · 0.45
ContainsMethod · 0.45
GetMethod · 0.45
whatMethod · 0.45
SizeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected