SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
ReportRes.cc
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 
7 
8 
9 namespace SWC { namespace Comm { namespace Protocol {
10 namespace Rgr { namespace Req {
11 
12 
15  : client::ConnQueue::ReqBase(Buffers::make(1)),
16  rgr(a_rgr) {
18  cbp->header.set(REPORT, 60000);
19 }
20 
23  rgr->rgrid,
26  );
27 }
28 
30  Params::Report::RspRes rsp_params;
31  int err = ev->error;
32  if(!err) {
33  try {
34  const uint8_t *ptr = ev->data.base;
35  size_t remain = ev->data.size;
36 
37  err = Serialization::decode_i32(&ptr, &remain);
38  if(!err)
39  rsp_params.decode(&ptr, &remain);
40 
41  } catch(...) {
44  err = e.code();
45  }
46  }
47  Env::Mngr::rangers()->rgr_report(rgr->rgrid, err, rsp_params);
48 }
49 
50 
51 }}}}}
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::Rgr::REPORT
@ REPORT
Definition: Commands.h:36
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
SWC::Comm::Protocol::Rgr::Req::ReportRes::rgr
Manager::Ranger::Ptr rgr
Definition: ReportRes.h:28
SWC::client::Query::ReqBase
Comm::client::ConnQueue::ReqBase ReqBase
Definition: Profiling.h:21
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Comm::Protocol::Rgr::Req::ReportRes::handle_no_conn
void handle_no_conn() override
Definition: Report.cc:60
SWC::Manager::Rangers::rgr_report
void rgr_report(rgrid_t rgrid, int err, const Comm::Protocol::Rgr::Params::Report::RspRes &rsp)
Definition: Rangers.cc:134
SWC::Manager::Ranger::Ptr
std::shared_ptr< Ranger > Ptr
Definition: Ranger.h:21
SWC::Comm::Buffers
Definition: Buffers.h:20
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::Comm::Protocol::Rgr::Req::ReportRes::handle
void handle(ConnHandlerPtr conn, const Event::Ptr &ev) override
Definition: Report.cc:64
SWC::Error::COMM_NOT_CONNECTED
@ COMM_NOT_CONNECTED
Definition: Error.h:64
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition: AppContext.h:17
ReportRes.h
SWC::Comm::client::ConnQueueReqBase::cbp
Buffers::Ptr cbp
Definition: ClientConnQueue.h:26
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::Comm::Protocol::Rgr::Params::Report::RESOURCES
@ RESOURCES
Definition: Report.h:22
SWC::Comm::Protocol::Rgr::Params::Report::RspRes
Definition: Report.h:53
SWC::Error::Exception
Definition: Exception.h:21
SWC::Serialization::decode_i32
SWC_CAN_INLINE uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:143
SWC::Comm::Protocol::Rgr::Req::ReportRes::ReportRes
ReportRes(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, Cb_t &&cb, const uint32_t timeout)
Definition: Report.cc:48
SWC::Env::Mngr::rangers
static SWC_CAN_INLINE Manager::Rangers * rangers() noexcept
Definition: MngrEnv.h:69