SWC-DB  v0.5.9 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
RangeQuerySelect.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_protocol_rgr_req_RangeQuerySelect_h
7 #define swcdb_db_protocol_rgr_req_RangeQuerySelect_h
8 
9 
14 
15 
16 namespace SWC { namespace Comm { namespace Protocol {
17 namespace Rgr { namespace Req {
18 
19 
20 template<typename DataT>
22  public:
23 
24  typedef std::shared_ptr<RangeQuerySelect> Ptr;
25  DataT data;
26 
27  template<typename... DataArgsT>
29  static Ptr make(
30  const Params::RangeQuerySelectReqRef& params,
31  const uint32_t timeout,
32  DataArgsT&&... args) {
33  return Ptr(new RangeQuerySelect(params, timeout, args...));
34  }
35 
37  static void request(const Ptr& req, const EndPoints& endpoints) {
38  req->data.get_clients()->get_rgr_queue(endpoints)->put(req);
39  }
40 
41  template<typename... DataArgsT>
43  static void request(
44  const Params::RangeQuerySelectReqRef& params,
45  const uint32_t timeout,
46  const EndPoints& endpoints,
47  DataArgsT&&... args) {
48  request(make(params, timeout, args...), endpoints);
49  }
50 
51  virtual ~RangeQuerySelect() noexcept { }
52 
53  bool valid() override {
54  return data.valid();
55  }
56 
57  void handle_no_conn() override {
59  data.callback(req(), rsp);
60  }
61 
62  void handle(ConnHandlerPtr, const Event::Ptr& ev) override {
64  ev->error, ev->data.base, ev->data.size, ev->data_ext);
65  data.callback(req(), rsp);
66  }
67 
68  protected:
69 
70  template<typename... DataArgsT>
73  const Params::RangeQuerySelectReqRef& params,
74  const uint32_t timeout,
75  DataArgsT&&... args)
76  : client::ConnQueue::ReqBase(
77  Buffers::make(params, 0, RANGE_QUERY_SELECT, timeout)
78  ),
79  data(args...) {
80  }
81 
82 };
83 
84 
85 
101 typedef Common::Req::function<
102  std::function<void(
103  void*,
106  )>
108 
109 
110 
111 
112 }}}}}
113 
114 
115 #endif // swcdb_db_protocol_rgr_req_RangeQuerySelect_h
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::data
DataT data
Definition: RangeQuerySelect.h:25
SWC::Comm::client::ConnQueueReqBase::req
SWC_CAN_INLINE Ptr req() noexcept
Definition: ClientConnQueue.h:39
SWC::client::Query::ReqBase
Comm::client::ConnQueue::ReqBase ReqBase
Definition: Profiling.h:21
SWC::Comm::client::ConnQueueReqBase
Definition: ClientConnQueue.h:22
RangeQuerySelect.h
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::make
static SWC_CAN_INLINE Ptr make(const Params::RangeQuerySelectReqRef &params, const uint32_t timeout, DataArgsT &&... args)
Definition: RangeQuerySelect.h:29
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::Ptr
std::shared_ptr< RangeQuerySelect > Ptr
Definition: RangeQuerySelect.h:24
handler_data.h
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::handle
void handle(ConnHandlerPtr, const Event::Ptr &ev) override
Definition: RangeQuerySelect.h:62
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect
Definition: RangeQuerySelect.h:21
SWC::Comm::Protocol::Rgr::Params::RangeQuerySelectReqRef
Definition: RangeQuerySelect.h:51
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::~RangeQuerySelect
virtual ~RangeQuerySelect() noexcept
Definition: RangeQuerySelect.h:51
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::request
static SWC_CAN_INLINE void request(const Ptr &req, const EndPoints &endpoints)
Definition: RangeQuerySelect.h:37
ClientConnQueue.h
SWC::Comm::Buffers
Definition: Buffers.h:20
Commands.h
SWC::Error::COMM_NOT_CONNECTED
@ COMM_NOT_CONNECTED
Definition: Error.h:64
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition: AppContext.h:17
SWC::Core::Vector< EndPoint >
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::handle_no_conn
void handle_no_conn() override
Definition: RangeQuerySelect.h:57
SWC::Comm::Protocol::Common::Req::function
Definition: handler_data.h:19
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::valid
bool valid() override
Definition: RangeQuerySelect.h:53
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::request
static SWC_CAN_INLINE void request(const Params::RangeQuerySelectReqRef &params, const uint32_t timeout, const EndPoints &endpoints, DataArgsT &&... args)
Definition: RangeQuerySelect.h:43
SWC::Comm::Protocol::Rgr::RANGE_QUERY_SELECT
@ RANGE_QUERY_SELECT
Definition: Commands.h:35
SWC::Comm::Protocol::Rgr::Req::Functional_RangeQuerySelect
Common::Req::function< std::function< void(void *, const client::ConnQueue::ReqBase::Ptr &, const Params::RangeQuerySelectRsp &)>> Functional_RangeQuerySelect
Definition: RangeQuerySelect.h:107
SWC::Comm::Event::Ptr
std::shared_ptr< Event > Ptr
Definition: Event.h:29
SWC::Comm::client::ConnQueueReqBase::Ptr
std::shared_ptr< ConnQueueReqBase > Ptr
Definition: ClientConnQueue.h:25
SWC::Comm::Protocol::Rgr::Params::RangeQuerySelectRsp
Definition: RangeQuerySelect.h:81
SWC::Comm::Protocol::Rgr::Req::RangeQuerySelect::RangeQuerySelect
SWC_CAN_INLINE RangeQuerySelect(const Params::RangeQuerySelectReqRef &params, const uint32_t timeout, DataArgsT &&... args)
Definition: RangeQuerySelect.h:72