| 144 | } |
| 145 | |
| 146 | BinarySet |
| 147 | InnerIndexInterface::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 | |
| 168 | void |
| 169 | InnerIndexInterface::Serialize(const WriteFuncType& write_func) const { |
no test coverage detected