|
SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
|
Go to the documentation of this file.
9 namespace SWC {
namespace client {
15 : queues(new Comm::client::ConnQueues(
16 Comm::client::Serialized::Ptr(new Comm::client::Serialized(
24 settings.get<Config::Property::Value_int32_g>(
25 "swc.client.Bkr.connection.timeout"),
26 settings.get<Config::Property::Value_uint16_g>(
27 "swc.client.Bkr.connection.probes"),
28 settings.get<Config::Property::Value_int32_g>(
29 "swc.client.Bkr.connection.keepalive"),
30 settings.get<Config::Property::Value_int32_g>(
31 "swc.client.request.again.delay")
34 settings.get<Config::Property::Value_strings_g>(
"swc.bkr.host")),
35 cfg_port(settings.get_i16(
"swc.bkr.port")),
36 m_mutex(), m_brokers() {
52 for(
auto& host_str : hosts) {
55 if((at = host_str.find_first_of(
'|')) == std::string::npos) {
59 host_str = host_str.substr(0, at);
65 at = host_str.find_first_of(
',');
66 if(at != std::string::npos) {
67 addr = host_str.substr(0, at);
68 host_str = host_str.substr(at+1, host_str.length());
75 }
while(at != std::string::npos);
84 for(
size_t n=0; n<_brokers.
size(); ++n) {
85 SWC_LOG_OSTREAM <<
"\n " << n <<
": ";
86 for(auto& e : _brokers[n])
87 SWC_LOG_OSTREAM << e <<
',';
138 if(!endpoints.empty()) {
139 queues->get(endpoints)->put(req);
143 req->handle_no_conn();
147 "Broker hosts cfg 'swc.bkr.host' is empty, waiting!");
148 std::this_thread::sleep_for(std::chrono::seconds(3));
153 if(++pos < brks.size())
constexpr SWC_CAN_INLINE reference front() noexcept
#define SWC_LOG_OUT(pr, _code_)
const Comm::client::ConnQueuesPtr queues
std::shared_ptr< IoContext > IoContextPtr
std::shared_ptr< ContextBroker > Ptr
const Config::Property::Value_strings_g::Ptr cfg_hosts
constexpr SWC_CAN_INLINE bool empty() const noexcept
#define SWC_LOG(priority, message)
The SWC-DB C++ namespace 'SWC'.
bool has_endpoints() noexcept
BrokersEndPoints m_brokers
void from_string(const char *s, double *value)
bool put(const Comm::client::ConnQueue::ReqBase::Ptr &req, BrokerIdx &idx)
bool turn_around(Brokers &brks) noexcept
void set(BrokersEndPoints &&endpoints)
bool is_ipv4_address(const std::string &str) noexcept
bool get(BrokerIdx &idx, Comm::EndPoints &endpoints)
std::shared_ptr< ConnQueueReqBase > Ptr
bool is_ipv6_address(const std::string &str) noexcept
EndPoints get_endpoints(uint16_t defaul_port, const Config::Strings &addrs, const std::string &host, const Networks &nets, bool srv=false)
SWC_CAN_INLINE void push_back(ArgsT &&... args)
void on_cfg_update() noexcept
constexpr SWC_CAN_INLINE size_type size() const noexcept
#define SWC_LOG_CURRENT_EXCEPTION(_s_)
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
SWC_CAN_INLINE Brokers() noexcept
SWC_CAN_INLINE void reserve(size_type cap)