Files
ternfs-XTXMarkets/cpp/core/Shuckle.hpp
Francesco Mazzoli b041d14860 Add second ip/addr for CDC/shards too
This is one of the two data model/protocol changes I want to perform
before going into production, the other being file atime.

Right now the kernel module does not take advantage of this, but
it's OK since I tested the rest of the code reasonably and the goal
here is to perform the protocol/data changes.
2023-06-05 12:14:14 +00:00

57 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,
uint32_t ip1,
uint16_t port1,
uint32_t ip2,
uint16_t port2
);
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,
uint32_t ip1,
uint16_t port1,
uint32_t ip2,
uint16_t port2,
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);