MCPcopy Create free account
hub / github.com/apple/foundationdb / writeMessage

Method writeMessage

fdbserver/LogSystem.cpp:298–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void LogPushData::writeMessage(StringRef rawMessageWithoutLength, bool usePreviousLocations) {
299 if (!usePreviousLocations) {
300 prev_tags.clear();
301 if (logSystem->hasRemoteLogs()) {
302 prev_tags.push_back(logSystem->getRandomRouterTag());
303 }
304 for (auto& tag : next_message_tags) {
305 prev_tags.push_back(tag);
306 }
307 msg_locations.clear();
308 logSystem->getPushLocations(prev_tags, msg_locations);
309 written_tags.insert(next_message_tags.begin(), next_message_tags.end());
310 next_message_tags.clear();
311 }
312 uint32_t subseq = this->subsequence++;
313 uint32_t msgsize =
314 rawMessageWithoutLength.size() + sizeof(subseq) + sizeof(uint16_t) + sizeof(Tag) * prev_tags.size();
315 for (int loc : msg_locations) {
316 BinaryWriter& wr = messagesWriter[loc];
317 wr << msgsize << subseq << uint16_t(prev_tags.size());
318 for (auto& tag : prev_tags)
319 wr << tag;
320 wr.serializeBytes(rawMessageWithoutLength);
321 }
322}
323
324std::vector<Standalone<StringRef>> LogPushData::getAllMessages() {
325 std::vector<Standalone<StringRef>> results;

Callers 1

Calls 10

hasRemoteLogsMethod · 0.80
getRandomRouterTagMethod · 0.80
clearMethod · 0.65
push_backMethod · 0.45
getPushLocationsMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
serializeBytesMethod · 0.45

Tested by

no test coverage detected