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

Method Serialize

src/algorithm/inner_index_interface.cpp:146–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146BinarySet
147InnerIndexInterface::Serialize() const {
148 std::string time_record_name = this->GetName() + " Serialize";
149 SlowTaskTimer t(time_record_name);
150
151 uint64_t num_bytes = this->CalSerializeSize();
152 // TODO(LHT): use try catch
153
154 std::shared_ptr<int8_t[]> bin(new int8_t[num_bytes]);
155 auto* buffer = reinterpret_cast<char*>(const_cast<int8_t*>(bin.get()));
156 BufferStreamWriter writer(buffer);
157 this->Serialize(writer);
158 Binary b{
159 .data = bin,
160 .size = num_bytes,
161 };
162 BinarySet bs;
163 bs.Set(this->GetName(), b);
164
165 return bs;
166}
167
168void
169InnerIndexInterface::Serialize(const WriteFuncType& write_func) const {

Callers 2

CalSerializeSizeMethod · 0.95
CloneMethod · 0.95

Calls 4

CalSerializeSizeMethod · 0.95
getMethod · 0.80
GetNameMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected