mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-05-03 08:19:58 -05:00
30ee029f7e
This means that they'll be interrupted at shutdown, rather than holding everything up when shuckle is overloaded. We also detect idle connection or slow transmitting data.
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "Msgs.hpp"
|
|
#include "MsgsGen.hpp"
|
|
|
|
// The host here is the scheme + host + port, e.g. `http://localhost:5000`.
|
|
//
|
|
// If the first number is non-zero, we errored out, and the element contains
|
|
// an 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).
|
|
//
|
|
// This function does double duty -- it both gets all the block services
|
|
// (the shard needs to know which ones exist to fill in addrs), but it also
|
|
// fills in the block services for the shard specifically.
|
|
std::pair<int, std::string> fetchBlockServices(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
ShardId shid,
|
|
std::vector<BlockServiceInfo>& blockServices,
|
|
std::vector<BlockServiceId>& currentBlockServices
|
|
);
|
|
|
|
std::pair<int, std::string> registerShardReplica(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
ShardReplicaId shrid,
|
|
bool isLeader,
|
|
const AddrsInfo& info
|
|
);
|
|
|
|
std::pair<int, std::string> fetchShardReplicas(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
ShardReplicaId shrid,
|
|
std::array<AddrsInfo, 5>& replicas
|
|
);
|
|
|
|
std::pair<int, std::string> registerCDCReplica(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
ReplicaId replicaId,
|
|
bool isLeader,
|
|
const AddrsInfo& info
|
|
);
|
|
|
|
std::pair<int, std::string> fetchCDCReplicas(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
std::array<AddrsInfo, 5>& replicas
|
|
);
|
|
|
|
std::pair<int, std::string> fetchShards(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
std::array<ShardInfo, 256>& shards
|
|
);
|
|
|
|
std::pair<int, std::string> insertStats(
|
|
const std::string& shuckleHost,
|
|
uint16_t shucklePort,
|
|
Duration timeout,
|
|
const std::vector<Stat>& stats
|
|
);
|
|
|
|
const std::string defaultShuckleAddress = "REDACTED";
|
|
bool parseShuckleAddress(const std::string& fullShuckleAddress, std::string& shuckleHost, uint16_t& shucklePort);
|