Files
ternfs-XTXMarkets/cpp/core/Shuckle.hpp
2023-02-15 14:03:53 +00:00

53 lines
1.5 KiB
C++

#pragma once
#include "Msgs.hpp"
// The host here is the scheme + host + port, e.g. `http://localhost:5000`.
//
// If it returns a string, the request has failed and the string contains the
// error. We only returns error strings for errors that might be transient
// (e.g. we cannot connect to the server, or the connection dies), and crash
// on things that are almost certainly not transient (e.g. bad data on
// the wire).
std::string fetchBlockServices(
const std::string& shuckleHost,
uint16_t shucklePort,
Duration timeout,
ShardId shid,
UpdateBlockServicesEntry& blocks
);
std::string registerShard(
const std::string& shuckleHost,
uint16_t shucklePort,
Duration timeout,
ShardId shid,
const std::array<uint8_t, 4>& shardAddr,
uint16_t shardPort
);
struct CDCStatus {
uint64_t queuedTxns;
// if non-zero, the following field is set too
CDCMessageKind executingTxnKind;
uint8_t executingTxnStep;
};
std::string registerCDC(
const std::string& shuckleHost,
uint16_t shucklePort,
Duration timeout,
const std::array<uint8_t, 4>& cdcAddr,
uint16_t cdcPort,
const CDCStatus& status
);
std::string fetchShards(
const std::string& shuckleHost,
uint16_t shucklePort,
Duration timeout,
std::array<ShardInfo, 256>& shards
);
const std::string defaultShuckleAddress = "REDACTED";
bool parseShuckleAddress(const std::string& fullShuckleAddress, std::string& shuckleHost, uint16_t& shucklePort);