Keep pinging shuckle

This commit is contained in:
Francesco Mazzoli
2023-01-30 12:13:12 +00:00
parent 85889266b1
commit df9efa481d
5 changed files with 309 additions and 135 deletions
+7 -2
View File
@@ -212,7 +212,7 @@ std::string registerCDC(const std::string& host, uint16_t port, Duration timeout
return {};
}
std::string fetchShards(const std::string& host, uint16_t port, Duration timeout, std::vector<ShardInfo>& shards) {
std::string fetchShards(const std::string& host, uint16_t port, Duration timeout, std::array<ShardInfo, 256>& shards) {
std::string errString;
int sock = shuckleSock(host, port, timeout, errString);
if (sock < 0) {
@@ -231,7 +231,12 @@ std::string fetchShards(const std::string& host, uint16_t port, Duration timeout
if (!errString.empty()) {
return errString;
}
shards = respContainer.getShards().shards.els;
if (respContainer.getShards().shards.els.size() != shards.size()) {
throw EGGS_EXCEPTION("expecting %s shards, got %s", shards.size(), respContainer.getShards().shards.els.size());
}
for (int i = 0; i < shards.size(); i++) {
shards[i] = respContainer.getShards().shards.els[i];
}
return {};
}
+1 -1
View File
@@ -39,7 +39,7 @@ std::string fetchShards(
const std::string& shuckleHost,
uint16_t shucklePort,
Duration timeout,
std::vector<ShardInfo>& shards
std::array<ShardInfo, 256>& shards
);
const std::string defaultShuckleAddress = "REDACTED";