Rename isEmptyMessage to messagesWritten

The variable name means exactly the opposite.
This commit is contained in:
Jingyu Zhou 2022-02-03 13:38:45 -08:00
parent 02fcb1a239
commit f361f5a96c
2 changed files with 7 additions and 7 deletions

View File

@ -308,19 +308,19 @@ void LogPushData::writeMessage(StringRef rawMessageWithoutLength, bool usePrevio
}
void LogPushData::recordEmptyMessage(int loc, const Standalone<StringRef>& value) {
if (!isEmptyMessage[loc]) {
if (!messagesWritten[loc]) {
BinaryWriter w(AssumeVersion(g_network->protocolVersion()));
Standalone<StringRef> v = w.toValue();
if (value.size() > v.size()) {
isEmptyMessage[loc] = true;
messagesWritten[loc] = true;
}
}
}
float LogPushData::getEmptyMessageRatio() const {
auto count = std::count(isEmptyMessage.begin(), isEmptyMessage.end(), false);
ASSERT_WE_THINK(isEmptyMessage.size() > 0);
return 1.0 * count / isEmptyMessage.size();
auto count = std::count(messagesWritten.begin(), messagesWritten.end(), false);
ASSERT_WE_THINK(messagesWritten.size() > 0);
return 1.0 * count / messagesWritten.size();
}
bool LogPushData::writeTransactionInfo(int location, uint32_t subseq) {

View File

@ -745,7 +745,7 @@ struct LogPushData : NonCopyable {
}
}
}
isEmptyMessage = std::vector<bool>(messagesWriter.size(), false);
messagesWritten = std::vector<bool>(messagesWriter.size(), false);
}
void addTxsTag();
@ -781,7 +781,7 @@ private:
std::vector<Tag> next_message_tags;
std::vector<Tag> prev_tags;
std::vector<BinaryWriter> messagesWriter;
std::vector<bool> isEmptyMessage; // if messagesWriter has written anything
std::vector<bool> messagesWritten; // if messagesWriter has written anything
std::vector<int> msg_locations;
// Stores message locations that have had span information written to them
// for the current transaction. Adding transaction info will reset this