change protocol version to hex encoded string in status json. Move constant from flow transport header to cpp

This commit is contained in:
Richard Chen 2020-10-26 19:35:38 +00:00
parent a671aa773e
commit 5b546c4854
4 changed files with 7 additions and 4 deletions

View File

@ -787,7 +787,7 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
{
"reachable":true,
"address":"127.0.0.1:4701",
"protocol": 1142507688261910528
"protocol": "0fdb00b070010001"
}
],
"quorum_reachable":true

View File

@ -28,6 +28,7 @@
#include "fdbclient/json_spirit/json_spirit_reader_template.h"
#include "fdbrpc/genericactors.actor.h"
#include "flow/actorcompiler.h" // has to be last include
#include <cstdint>
json_spirit::mValue readJSONStrictly(const std::string &s) {
json_spirit::mValue val;
@ -320,7 +321,10 @@ ACTOR Future<Optional<StatusObject>> clientCoordinatorsStatusFetcher(Reference<C
coordStatus["reachable"] = false;
}
if (coordProtocols[i].isReady()) {
coordStatus["protocol"] = coordProtocols[i].get().version.version();
uint64_t protocolVersionInt = coordProtocols[i].get().version.version();
std::stringstream hexSs;
hexSs << std::hex << std::setw(2*sizeof(protocolVersionInt)) << std::setfill('0') << protocolVersionInt;
coordStatus["protocol"] = hexSs.str();
}
coordsStatus.push_back(coordStatus);
}

View File

@ -48,6 +48,7 @@ static NetworkAddressList g_currentDeliveryPeerAddress = NetworkAddressList();
constexpr UID WLTOKEN_ENDPOINT_NOT_FOUND(-1, 0);
constexpr UID WLTOKEN_PING_PACKET(-1, 1);
constexpr int PACKET_LEN_WIDTH = sizeof(uint32_t);
const uint64_t TOKEN_STREAM_FLAG = 1;
class EndpointMap : NonCopyable {

View File

@ -254,6 +254,4 @@ inline bool Endpoint::isLocal() const {
return addresses.address == localAddrs.address || (localAddrs.secondaryAddress.present() && addresses.address == localAddrs.secondaryAddress.get());
}
const int PACKET_LEN_WIDTH = sizeof(uint32_t);
#endif