SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Brokers.h
Go to the documentation of this file.
1
/*
2
* SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3
* License details at <https://github.com/kashirin-alex/swc-db/#license>
4
*/
5
6
#ifndef swcdb_db_client_brk_Brokers_h
7
#define swcdb_db_client_brk_Brokers_h
8
9
10
#include "
swcdb/db/client/service/bkr/ContextBroker.h
"
11
#include "
swcdb/core/comm/ClientConnQueues.h
"
12
13
14
namespace
SWC
{
namespace
client {
15
16
17
18
class
Brokers
{
19
public
:
20
21
typedef
Core::Vector<Comm::EndPoints>
BrokersEndPoints
;
22
23
struct
BrokerIdx
{
24
size_t
pos
;
25
SWC_CAN_INLINE
26
BrokerIdx
() noexcept :
pos
(0) { }
27
bool
turn_around
(
Brokers
& brks) noexcept;
28
};
29
30
SWC_CAN_INLINE
31
Brokers
() noexcept
32
:
queues
(
nullptr
),
cfg_hosts
(
nullptr
),
cfg_port
(0),
33
m_mutex
(),
m_brokers
() {
34
}
35
36
Brokers
(
const
Config::Settings
& settings,
37
Comm::IoContextPtr
ioctx,
38
const
ContextBroker::Ptr
& bkr_ctx);
39
40
Brokers
(
const
Brokers
&) =
delete
;
41
42
Brokers
&
operator=
(
const
Brokers
&) =
delete
;
43
44
~Brokers
() noexcept { }
45
46
void
on_cfg_update
() noexcept;
47
48
size_t
size
() noexcept;
49
50
bool
get
(BrokerIdx& idx, Comm::
EndPoints
& endpoints);
51
52
bool
has_endpoints
() noexcept;
53
54
void
set
(
BrokersEndPoints
&& endpoints);
55
56
void
set
(const
BrokersEndPoints
& endpoints);
57
58
bool
put
(const Comm::client::ConnQueue::
ReqBase
::Ptr& req, BrokerIdx& idx);
59
60
const Comm::client::
ConnQueuesPtr
queues
;
61
const Config::Property::Value_strings_g::Ptr
cfg_hosts
;
62
const uint16_t
cfg_port
;
63
64
private:
65
Core::MutexSptd
m_mutex
;
66
BrokersEndPoints
m_brokers
;
67
};
68
69
70
71
}}
// namespace SWC::client
72
73
74
75
76
#ifdef SWC_IMPL_SOURCE
77
#include "
swcdb/db/client/service/bkr/Brokers.cc
"
78
#endif
79
80
81
#endif // swcdb_db_client_brk_Brokers_h
SWC::client::Brokers::~Brokers
~Brokers() noexcept
Definition:
Brokers.h:44
Brokers.cc
SWC::client::Brokers::BrokerIdx
Definition:
Brokers.h:23
SWC::client::Brokers::queues
const Comm::client::ConnQueuesPtr queues
Definition:
Brokers.h:60
SWC::client::Brokers
Definition:
Brokers.h:18
SWC::client::Query::ReqBase
Comm::client::ConnQueue::ReqBase ReqBase
Definition:
Profiling.h:21
SWC::Comm::IoContextPtr
std::shared_ptr< IoContext > IoContextPtr
Definition:
IoContext.h:16
SWC::client::Brokers::m_mutex
Core::MutexSptd m_mutex
Definition:
Brokers.h:65
SWC::client::ContextBroker::Ptr
std::shared_ptr< ContextBroker > Ptr
Definition:
ContextBroker.h:18
SWC::client::Brokers::operator=
Brokers & operator=(const Brokers &)=delete
SWC::client::Brokers::cfg_hosts
const Config::Property::Value_strings_g::Ptr cfg_hosts
Definition:
Brokers.h:61
ContextBroker.h
SWC::client::Brokers::BrokerIdx::pos
size_t pos
Definition:
Brokers.h:24
SWC::Comm::client::ConnQueuesPtr
std::shared_ptr< ConnQueues > ConnQueuesPtr
Definition:
ClientConnQueues.h:14
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition:
Compat.h:102
SWC
The SWC-DB C++ namespace 'SWC'.
Definition:
main.cc:12
SWC::client::Brokers::has_endpoints
bool has_endpoints() noexcept
Definition:
Brokers.cc:112
SWC::client::Brokers::m_brokers
BrokersEndPoints m_brokers
Definition:
Brokers.h:66
SWC::client::Brokers::Brokers
Brokers(const Brokers &)=delete
SWC::Comm::EndPoints
Core::Vector< EndPoint > EndPoints
Definition:
Resolver.h:20
SWC::Config::Settings
Definition:
Settings.h:25
SWC::client::Brokers::put
bool put(const Comm::client::ConnQueue::ReqBase::Ptr &req, BrokerIdx &idx)
Definition:
Brokers.cc:127
ClientConnQueues.h
SWC::client::Brokers::BrokerIdx::turn_around
bool turn_around(Brokers &brks) noexcept
Definition:
Brokers.cc:152
SWC::client::Brokers::BrokerIdx::BrokerIdx
SWC_CAN_INLINE BrokerIdx() noexcept
Definition:
Brokers.h:26
SWC::Core::Vector< Comm::EndPoints >
SWC::client::Brokers::set
void set(BrokersEndPoints &&endpoints)
Definition:
Brokers.cc:117
SWC::client::Brokers::BrokersEndPoints
Core::Vector< Comm::EndPoints > BrokersEndPoints
Definition:
Brokers.h:21
SWC::client::Brokers::get
bool get(BrokerIdx &idx, Comm::EndPoints &endpoints)
Definition:
Brokers.cc:103
SWC::client::Brokers::size
size_t size() noexcept
Definition:
Brokers.cc:98
SWC::client::Brokers::on_cfg_update
void on_cfg_update() noexcept
Definition:
Brokers.cc:40
SWC::client::Brokers::Brokers
SWC_CAN_INLINE Brokers() noexcept
Definition:
Brokers.h:31
SWC::client::Brokers::cfg_port
const uint16_t cfg_port
Definition:
Brokers.h:62
include
swcdb
db
client
service
bkr
Brokers.h
Generated on Sat Jun 3 2023 18:00:06 for SWC-DB by
1.8.20