MCPcopy Create free account
hub / github.com/bytedance/bolt / deserialize

Method deserialize

bolt/exec/OperatorTraceReader.cpp:148–171  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

146
147// static
148std::vector<std::string> OperatorTraceSplitReader::deserialize(
149 common::FileInputStream* stream) {
150 std::vector<std::string> splits;
151 try {
152 while (!stream->atEnd()) {
153 const auto length = stream->read<uint32_t>();
154 std::string splitStr(length, '\0');
155 stream->readBytes(reinterpret_cast<uint8_t*>(splitStr.data()), length);
156 const auto crc32 = stream->read<uint32_t>();
157 const auto actualCrc32 = folly::crc32(
158 reinterpret_cast<const uint8_t*>(splitStr.data()), splitStr.size());
159 if (crc32 != actualCrc32) {
160 LOG(ERROR) << "Failed to verify the split checksum " << crc32
161 << " which does not equal to the actual computed checksum "
162 << actualCrc32;
163 break;
164 }
165 splits.push_back(std::move(splitStr));
166 }
167 } catch (const BoltException& e) {
168 LOG(ERROR) << "Failed to deserialize split: " << e.message();
169 }
170 return splits;
171}
172} // namespace bytedance::bolt::exec::trace

Callers

nothing calls this directly

Calls 7

messageMethod · 0.80
crc32Function · 0.50
atEndMethod · 0.45
readBytesMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected