SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
RangeUnloadInternal.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_ranger_callbacks_RangeUnloadInternal_h
7 #define swcdb_ranger_callbacks_RangeUnloadInternal_h
8 
10 
11 
12 namespace SWC { namespace Ranger { namespace Callback {
13 
14 
15 class RangeUnloadInternal final : public ManageBase {
16  public:
17 
18  typedef std::shared_ptr<RangeUnloadInternal> Ptr;
19  const cid_t cid;
20  const rid_t rid;
21 
23  RangeUnloadInternal(const cid_t a_cid, const rid_t a_rid) noexcept
24  : ManageBase(nullptr, nullptr, ManageBase::RANGE_UNLOAD_INTERNAL),
25  cid(a_cid), rid(a_rid) {
26  }
27 
28  virtual ~RangeUnloadInternal() noexcept { }
29 
30  void run() override { }
31 
32  void response(int&) override { }
33 
34  void send_error(int, const std::string&) override { }
35 
36  void response_ok() override { }
37 
38  void response() {
41  10000, cid, rid
42  );
43  }
44 
45  private:
46 
47  struct ReqData {
48  const cid_t cid;
49  const rid_t rid;
51  ReqData(cid_t a_cid, rid_t a_rid) noexcept : cid(a_cid), rid(a_rid) { }
53  cid_t get_cid() const noexcept {
54  return cid;
55  }
58  return Env::Clients::get();
59  }
61  bool valid() noexcept {
63  }
65  void callback(
69  "RangeUnloadInternal err=%d(%s) " SWC_FMT_LU "/" SWC_FMT_LU,
70  rsp.err, Error::get_text(rsp.err), cid, rid);
71  if(rsp.err && valid() &&
72  rsp.err != Error::CLIENT_STOPPING &&
76  req->request_again();
77  }
78  }
79  };
80 
81 };
82 
83 
84 }}}
85 #endif // swcdb_ranger_callbacks_RangeUnloadInternal_h
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::get_clients
SWC_CAN_INLINE client::Clients::Ptr & get_clients() noexcept
Definition: RangeUnloadInternal.h:57
SWC::Ranger::Callback::RangeUnloadInternal::response
void response(int &) override
Definition: RangeUnloadInternal.h:32
SWC::Comm::Protocol::Mngr::Params::RangeUnloadedRsp::err
int err
Definition: RangeUnloaded.h:78
SWC::Env::Clients::get
static SWC_CAN_INLINE client::Clients::Ptr & get() noexcept
Definition: Clients.h:299
SWC_LOGF
#define SWC_LOGF(priority, fmt,...)
Definition: Logger.h:188
SWC::Ranger::Callback::ManageBase
Definition: ManageBase.h:20
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::get_cid
SWC_CAN_INLINE cid_t get_cid() const noexcept
Definition: RangeUnloadInternal.h:53
SWC::Error::get_text
const char * get_text(const int err) noexcept
Definition: Error.cc:173
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::rid
const rid_t rid
Definition: RangeUnloadInternal.h:49
SWC::client::Clients::Ptr
ClientsPtr Ptr
Definition: Clients.h:58
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::cid
const cid_t cid
Definition: RangeUnloadInternal.h:48
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::valid
SWC_CAN_INLINE bool valid() noexcept
Definition: RangeUnloadInternal.h:61
SWC::Ranger::Callback::RangeUnloadInternal::RangeUnloadInternal
SWC_CAN_INLINE RangeUnloadInternal(const cid_t a_cid, const rid_t a_rid) noexcept
Definition: RangeUnloadInternal.h:23
SWC::Comm::Protocol::Mngr::Req::RangeUnloaded::request
static SWC_CAN_INLINE void request(const Params::RangeUnloadedReq &params, const uint32_t timeout, DataArgsT &&... args)
Definition: RangeUnloaded.h:36
SWC::Ranger::Callback::ManageBase::ManageBase
SWC_CAN_INLINE ManageBase(const Comm::ConnHandlerPtr &conn, const Comm::Event::Ptr &ev, Action a_action)
Definition: ManageBase.h:36
SWC::Ranger::Callback::RangeUnloadInternal::rid
const rid_t rid
Definition: RangeUnloadInternal.h:20
SWC::Ranger::Callback::RangeUnloadInternal
Definition: RangeUnloadInternal.h:15
SWC::Ranger::Callback::RangeUnloadInternal::Ptr
std::shared_ptr< RangeUnloadInternal > Ptr
Definition: RangeUnloadInternal.h:18
SWC::Ranger::Callback::RangeUnloadInternal::response_ok
void response_ok() override
Definition: RangeUnloadInternal.h:36
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::LOG_DEBUG
@ LOG_DEBUG
Definition: Logger.h:36
SWC::Comm::Protocol::Mngr::Params::RangeUnloadedReq
Definition: RangeUnloaded.h:16
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Ranger::Callback::RangeUnloadInternal::~RangeUnloadInternal
virtual ~RangeUnloadInternal() noexcept
Definition: RangeUnloadInternal.h:28
SWC::Ranger::Callback::ManageBase::RANGE_UNLOAD_INTERNAL
@ RANGE_UNLOAD_INTERNAL
Definition: ManageBase.h:28
SWC::Error::COLUMN_NOT_READY
@ COLUMN_NOT_READY
Definition: Error.h:99
SWC::Ranger::Callback::RangeUnloadInternal::cid
const cid_t cid
Definition: RangeUnloadInternal.h:19
SWC::Error::CLIENT_STOPPING
@ CLIENT_STOPPING
Definition: Error.h:127
SWC_FMT_LU
#define SWC_FMT_LU
Definition: Compat.h:98
RangeUnloaded.h
SWC::cid_t
uint64_t cid_t
Definition: Identifiers.h:16
SWC::Error::COLUMN_NOT_EXISTS
@ COLUMN_NOT_EXISTS
Definition: Error.h:100
SWC::Ranger::Callback::RangeUnloadInternal::send_error
void send_error(int, const std::string &) override
Definition: RangeUnloadInternal.h:34
SWC::Comm::Protocol::Mngr::Params::RangeUnloadedRsp
Definition: RangeUnloaded.h:59
SWC::Ranger::Callback::RangeUnloadInternal::response
void response()
Definition: RangeUnloadInternal.h:38
SWC::Ranger::Callback::RangeUnloadInternal::run
void run() override
Definition: RangeUnloadInternal.h:30
SWC::Error::COLUMN_MARKED_REMOVED
@ COLUMN_MARKED_REMOVED
Definition: Error.h:102
SWC::rid_t
uint64_t rid_t
Definition: Identifiers.h:17
SWC::Env::Rgr::is_not_accepting
static SWC_CAN_INLINE bool is_not_accepting() noexcept
Definition: RangerEnv.h:53
SWC::Ranger::Callback::RangeUnloadInternal::ReqData
Definition: RangeUnloadInternal.h:47
SWC::Comm::client::ConnQueueReqBase::Ptr
std::shared_ptr< ConnQueueReqBase > Ptr
Definition: ClientConnQueue.h:25
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::callback
SWC_CAN_INLINE void callback(const Comm::client::ConnQueue::ReqBase::Ptr &req, const Comm::Protocol::Mngr::Params::RangeUnloadedRsp &rsp)
Definition: RangeUnloadInternal.h:65
SWC::Ranger::Callback::RangeUnloadInternal::ReqData::ReqData
SWC_CAN_INLINE ReqData(cid_t a_cid, rid_t a_rid) noexcept
Definition: RangeUnloadInternal.h:51