SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
RgrUpdate.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 
7 #ifndef swcdb_manager_Protocol_handlers_RgrUpdate_h
8 #define swcdb_manager_Protocol_handlers_RgrUpdate_h
9 
11 
12 
13 namespace SWC { namespace Comm { namespace Protocol {
14 namespace Mngr { namespace Handler {
15 
16 
17 struct RgrUpdate {
20 
23  const Comm::Event::Ptr& a_ev) noexcept
24  : conn(a_conn), ev(a_ev) {
25  }
26 
28  RgrUpdate(RgrUpdate&& other) noexcept
29  : conn(std::move(other.conn)), ev(std::move(other.ev)) {
30  }
31 
32  RgrUpdate(const RgrUpdate&) = delete;
34  RgrUpdate& operator=(const RgrUpdate&) = delete;
35 
36  ~RgrUpdate() noexcept { }
37 
38  void operator()() {
39  if(ev->expired())
40  return;
41 
42  try {
43  const uint8_t *ptr = ev->data.base;
44  size_t remain = ev->data.size;
45 
46  Params::RgrUpdate params;
47  params.decode(&ptr, &remain);
48 
49  conn->response_ok(ev);
51 
52  } catch(...) {
55  conn->send_error(e.code(), "", ev);
56  }
57  }
58 
59 };
60 
61 
62 }}}}}
63 
64 #endif // swcdb_manager_Protocol_handlers_RgrUpdate_h
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::RgrUpdate
SWC_CAN_INLINE RgrUpdate(const Comm::ConnHandlerPtr &a_conn, const Comm::Event::Ptr &a_ev) noexcept
Definition: RgrUpdate.h:22
SWC::Error::Exception::code
constexpr SWC_CAN_INLINE int code() const noexcept
Definition: Exception.h:51
SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition: Logger.h:44
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::conn
Comm::ConnHandlerPtr conn
Definition: RgrUpdate.h:18
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
RgrUpdate.h
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::ev
Comm::Event::Ptr ev
Definition: RgrUpdate.h:19
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::RgrUpdate
SWC_CAN_INLINE RgrUpdate(RgrUpdate &&other) noexcept
Definition: RgrUpdate.h:28
SWC::Comm::Protocol::Mngr::Params::RgrUpdate::sync_all
bool sync_all
Definition: RgrUpdate.h:44
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition: AppContext.h:17
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::operator()
void operator()()
Definition: RgrUpdate.h:38
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::operator=
RgrUpdate & operator=(RgrUpdate &&)=delete
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::~RgrUpdate
~RgrUpdate() noexcept
Definition: RgrUpdate.h:36
SWC::Comm::Serializable::decode
void decode(const uint8_t **bufp, size_t *remainp)
Definition: Serializable.h:59
SWC::Comm::Event::Ptr
std::shared_ptr< Event > Ptr
Definition: Event.h:33
SWC::Manager::Rangers::update_status
void update_status(const RangerList &new_rgr_status, bool sync_all)
Definition: Rangers.cc:281
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate
Definition: RgrUpdate.h:17
SWC::Comm::Protocol::Mngr::Params::RgrUpdate
Definition: RgrUpdate.h:15
SWC::Error::Exception
Definition: Exception.h:21
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::operator=
RgrUpdate & operator=(const RgrUpdate &)=delete
SWC::Env::Mngr::rangers
static SWC_CAN_INLINE Manager::Rangers * rangers() noexcept
Definition: MngrEnv.h:69
SWC::Comm::Protocol::Mngr::Params::RgrUpdate::hosts
Manager::RangerList hosts
Definition: RgrUpdate.h:43
SWC::Comm::Protocol::Mngr::Handler::RgrUpdate::RgrUpdate
RgrUpdate(const RgrUpdate &)=delete