SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::client::Mngr::Groups Class Referencefinal

#include <swcdb/db/client/service/mngr/Groups.h>

+ Inheritance diagram for SWC::client::Mngr::Groups:
+ Collaboration diagram for SWC::client::Mngr::Groups:

Classes

struct  GroupHost
 

Public Types

typedef std::shared_ptr< GroupsPtr
 
typedef Core::Vector< Group::PtrVec
 

Public Member Functions

 Groups (const Config::Settings &settings)
 
 Groups (const Groups &other, Groups::Vec &&)
 
 Groups (const Groups &)=delete
 
Groupsoperator= (const Groups &)=delete
 
 ~Groups () noexcept
 
Ptr init ()
 
Ptr copy ()
 
void on_cfg_update ()
 
Vec get_groups ()
 
void hosts (uint8_t role, cid_t cid, Hosts &hosts, GroupHost &group_host)
 
Vec get_groups (const Comm::EndPoints &endpoints)
 
Comm::EndPoints get_endpoints (uint8_t role=0, cid_t cid_begin=0, cid_t cid_end=0)
 
void print (std::ostream &out)
 
void add (GroupHost &&g_host)
 
void remove (const Comm::EndPoints &endpoints)
 
void select (const cid_t &cid, Comm::EndPoints &endpoints)
 
void select (const uint8_t &role, Comm::EndPoints &endpoints)
 

Private Member Functions

void _add_host (uint8_t role, cid_t cid_begin, cid_t cid_end, uint16_t port, std::string host_or_ips)
 
- Private Member Functions inherited from SWC::Core::Vector< Group::Ptr >
constexpr SWC_CAN_INLINE Vector () noexcept
 
SWC_CAN_INLINE Vector (size_type sz, ArgsT &&... args)
 
constexpr SWC_CAN_INLINE Vector (Vector &&other) noexcept
 
SWC_CAN_INLINE Vector (const Vector &other)
 
SWC_CAN_INLINE Vector (const_iterator _b, const_iterator _e)
 
SWC_CAN_INLINE Vector (std::initializer_list< value_type > &&l)
 
SWC_CAN_INLINE ~Vector () noexcept(_NoExceptDestructor)
 
SWC_CAN_INLINE void clear () noexcept(_NoExceptDestructor)
 
SWC_CAN_INLINE void free () noexcept
 
SWC_CAN_INLINE Vectoroperator= (Vector &&other) noexcept
 
SWC_CAN_INLINE Vectoroperator= (const Vector &other)
 
SWC_CAN_INLINE void swap (Vector &other) noexcept
 
constexpr SWC_CAN_INLINE bool empty () const noexcept
 
constexpr SWC_CAN_INLINE bool operator== (const Vector &other) const noexcept
 
constexpr SWC_CAN_INLINE bool operator!= (const Vector &other) const noexcept
 
constexpr SWC_CAN_INLINE size_type size () const noexcept
 
constexpr SWC_CAN_INLINE size_type capacity () const noexcept
 
constexpr SWC_CAN_INLINE pointer data () noexcept
 
constexpr SWC_CAN_INLINE const_pointer data () const noexcept
 
constexpr SWC_CAN_INLINE iterator begin () noexcept
 
constexpr SWC_CAN_INLINE const_iterator begin () const noexcept
 
constexpr SWC_CAN_INLINE const_iterator cbegin () const noexcept
 
constexpr SWC_CAN_INLINE iterator end () noexcept
 
constexpr SWC_CAN_INLINE const_iterator end () const noexcept
 
constexpr SWC_CAN_INLINE const_iterator cend () const noexcept
 
constexpr SWC_CAN_INLINE reference front () noexcept
 
constexpr SWC_CAN_INLINE const_reference front () const noexcept
 
constexpr SWC_CAN_INLINE reference back () noexcept
 
constexpr SWC_CAN_INLINE const_reference back () const noexcept
 
constexpr SWC_CAN_INLINE reference operator[] (size_type pos) noexcept
 
constexpr SWC_CAN_INLINE const_reference operator[] (size_type pos) const noexcept
 
SWC_CAN_INLINE void shrink_to_fit (size_type sz=0)
 
SWC_CAN_INLINE void reserve (size_type cap)
 
SWC_CAN_INLINE void reserve ()
 
SWC_CAN_INLINE void resize (size_type sz, ArgsT &&... args)
 
SWC_CAN_INLINE void push_back (ArgsT &&... args)
 
SWC_CAN_INLINE void push_back_unsafe (ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE reference emplace_back (ArgsT &&... args)
 
SWC_CAN_INLINE reference emplace_back_unsafe (ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE iterator insert (size_type offset, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert (const_iterator it, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert (size_type offset, const_iterator first, const_iterator last)
 
SWC_CAN_INLINE iterator insert (const_iterator it, const_iterator first, const_iterator last)
 
SWC_CAN_INLINE reference emplace (const_iterator it, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert_unsafe (const_iterator it, ArgsT &&... args) noexcept(_NoExceptMove &&_NoExceptDestructor &&std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE void assign (IteratorT first, IteratorT last)
 
SWC_CAN_INLINE iterator erase (size_type offset) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE iterator erase (const_iterator it) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE iterator erase (const_iterator first, const_iterator last) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE void pop_back () noexcept(_NoExceptDestructor)
 

Private Attributes

Config::Property::Value_strings_g::Ptr cfg_hosts
 
const uint16_t cfg_port
 
Core::MutexSptd m_mutex
 
Core::Vector< GroupHostm_active_g_host
 
Comm::Networks m_nets
 

Additional Inherited Members

- Private Types inherited from SWC::Core::Vector< Group::Ptr >
using value_type = Group::Ptr
 
using size_type = uint32_t
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typeiterator
 
typedef const value_typeconst_iterator
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
- Static Private Member Functions inherited from SWC::Core::Vector< Group::Ptr >
constexpr static SWC_CAN_INLINE size_type max_size () noexcept
 

Detailed Description

Definition at line 60 of file Groups.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<Groups> SWC::client::Mngr::Groups::Ptr

Definition at line 78 of file Groups.h.

◆ Vec

Definition at line 79 of file Groups.h.

Constructor & Destructor Documentation

◆ Groups() [1/3]

SWC::client::Mngr::Groups::Groups ( const Config::Settings settings)

Definition at line 92 of file Groups.cc.

References SWC::Error::CONFIG_BAD_VALUE, SWC::Comm::Resolver::get_networks(), SWC::Config::Properties::get_strs(), m_nets, and SWC_THROWF.

Referenced by copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Groups() [2/3]

SWC::client::Mngr::Groups::Groups ( const Groups other,
Groups::Vec &&  groups 
)

Definition at line 109 of file Groups.cc.

◆ Groups() [3/3]

SWC::client::Mngr::Groups::Groups ( const Groups )
delete

◆ ~Groups()

SWC::client::Mngr::Groups::~Groups ( )
inlinenoexcept

Definition at line 89 of file Groups.h.

Member Function Documentation

◆ _add_host()

void SWC::client::Mngr::Groups::_add_host ( uint8_t  role,
cid_t  cid_begin,
cid_t  cid_end,
uint16_t  port,
std::string  host_or_ips 
)
private

Definition at line 214 of file Groups.cc.

References SWC::Core::Vector< Group::Ptr >::emplace_back(), SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), SWC::Comm::Resolver::get_endpoints(), SWC::Comm::Resolver::is_ipv4_address(), SWC::Comm::Resolver::is_ipv6_address(), m_nets, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

Referenced by on_cfg_update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add()

void SWC::client::Mngr::Groups::add ( Groups::GroupHost &&  g_host)

Definition at line 311 of file Groups.cc.

References SWC::Comm::has_endpoint(), m_active_g_host, and m_mutex.

+ Here is the call graph for this function:

◆ copy()

Groups::Ptr SWC::client::Mngr::Groups::copy ( )

Definition at line 122 of file Groups.cc.

References Groups(), m_mutex, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), SWC::Core::Vector< T, SizeT, GROW_SZ >::reserve(), and SWC::Core::Vector< Group::Ptr >::size().

+ Here is the call graph for this function:

◆ get_endpoints()

Comm::EndPoints SWC::client::Mngr::Groups::get_endpoints ( uint8_t  role = 0,
cid_t  cid_begin = 0,
cid_t  cid_end = 0 
)

Definition at line 285 of file Groups.cc.

References m_mutex.

◆ get_groups() [1/2]

Groups::Vec SWC::client::Mngr::Groups::get_groups ( )

Definition at line 248 of file Groups.cc.

References SWC::Core::Vector< Group::Ptr >::cbegin(), SWC::Core::Vector< Group::Ptr >::cend(), and m_mutex.

+ Here is the call graph for this function:

◆ get_groups() [2/2]

Groups::Vec SWC::client::Mngr::Groups::get_groups ( const Comm::EndPoints endpoints)

Definition at line 271 of file Groups.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), m_mutex, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

+ Here is the call graph for this function:

◆ hosts()

void SWC::client::Mngr::Groups::hosts ( uint8_t  role,
cid_t  cid,
Hosts hosts,
Groups::GroupHost group_host 
)

Definition at line 253 of file Groups.cc.

References SWC::client::Mngr::Groups::GroupHost::cid_begin, SWC::client::Mngr::Groups::GroupHost::cid_end, SWC::DB::Types::MngrRole::COLUMNS, m_mutex, and SWC::client::Mngr::Groups::GroupHost::role.

Referenced by on_cfg_update().

+ Here is the caller graph for this function:

◆ init()

Groups::Ptr SWC::client::Mngr::Groups::init ( )

Definition at line 115 of file Groups.cc.

References cfg_hosts, on_cfg_update(), and SWC::Config::Property::Value_strings_g::set_cb_on_chg().

+ Here is the call graph for this function:

◆ on_cfg_update()

void SWC::client::Mngr::Groups::on_cfg_update ( )

Definition at line 131 of file Groups.cc.

References _add_host(), SWC::DB::Types::MngrRole::ALL, cfg_hosts, cfg_port, SWC::Core::Vector< Group::Ptr >::clear(), SWC::DB::Types::MngrRole::COLUMNS, SWC::Config::Property::from_string(), SWC::Config::Property::Value_strings_g::get(), hosts(), SWC::Core::MutexSptd::lock(), SWC::LOG_DEBUG, m_mutex, SWC::DB::Types::MngrRole::NO_COLUMNS, print(), SWC::DB::Types::MngrRole::RANGERS, SWC::DB::Types::MngrRole::SCHEMAS, SWC::Condition::str_case_eq(), SWC_LOG, SWC_LOG_OSTREAM, SWC_LOG_OUT, SWC_LOGF, and SWC::Core::MutexSptd::unlock().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

Groups& SWC::client::Mngr::Groups::operator= ( const Groups )
delete

◆ print()

void SWC::client::Mngr::Groups::print ( std::ostream &  out)

Definition at line 303 of file Groups.cc.

References m_mutex.

Referenced by on_cfg_update().

+ Here is the caller graph for this function:

◆ remove()

void SWC::client::Mngr::Groups::remove ( const Comm::EndPoints endpoints)

Definition at line 327 of file Groups.cc.

References SWC::Comm::has_endpoint(), m_active_g_host, and m_mutex.

+ Here is the call graph for this function:

◆ select() [1/2]

void SWC::client::Mngr::Groups::select ( const cid_t cid,
Comm::EndPoints endpoints 
)

Definition at line 338 of file Groups.cc.

References SWC::DB::Types::MngrRole::COLUMNS, m_active_g_host, and m_mutex.

◆ select() [2/2]

void SWC::client::Mngr::Groups::select ( const uint8_t &  role,
Comm::EndPoints endpoints 
)

Definition at line 351 of file Groups.cc.

References m_active_g_host, and m_mutex.

Member Data Documentation

◆ cfg_hosts

Config::Property::Value_strings_g::Ptr SWC::client::Mngr::Groups::cfg_hosts
private

Definition at line 121 of file Groups.h.

Referenced by init(), and on_cfg_update().

◆ cfg_port

const uint16_t SWC::client::Mngr::Groups::cfg_port
private

Definition at line 122 of file Groups.h.

Referenced by on_cfg_update().

◆ m_active_g_host

Core::Vector<GroupHost> SWC::client::Mngr::Groups::m_active_g_host
private

Definition at line 125 of file Groups.h.

Referenced by add(), remove(), and select().

◆ m_mutex

Core::MutexSptd SWC::client::Mngr::Groups::m_mutex
private

Definition at line 124 of file Groups.h.

Referenced by add(), copy(), get_endpoints(), get_groups(), hosts(), on_cfg_update(), print(), remove(), and select().

◆ m_nets

Comm::Networks SWC::client::Mngr::Groups::m_nets
private

Definition at line 126 of file Groups.h.

Referenced by _add_host(), and Groups().


The documentation for this class was generated from the following files: