SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Length.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_fs_Broker_Protocol_req_Length_h
7 #define swcdb_fs_Broker_Protocol_req_Length_h
8 
11 
12 
13 namespace SWC { namespace Comm { namespace Protocol {
14 namespace FsBroker { namespace Req {
15 
16 
17 class Length final : public Base {
18  public:
19  typedef std::shared_ptr<Length> Ptr;
20 
23  uint32_t timeout, const std::string& a_name,
25  : Base(
26  stats, FS::Statistics::LENGTH_ASYNC,
27  Buffers::make(
28  Params::LengthReq(a_name),
29  0,
30  FUNCTION_LENGTH, timeout
31  )
32  ),
33  name(a_name), cb(std::move(a_cb)) {
34  }
35 
36  ~Length() noexcept { }
37 
38  void handle(ConnHandlerPtr, const Event::Ptr& ev) override {
39  size_t length = 0;
41  cb(error, length);
42  }
43 
44  private:
45  const std::string name;
47 
48 };
49 
50 
51 }}}}}
52 
53 
54 #endif // swcdb_fs_Broker_Protocol_req_Length_h
SWC::FS::Callback::LengthCb_t
std::function< void(int, size_t)> LengthCb_t
Definition: Callbacks.h:22
SWC::Comm::Protocol::FsBroker::Req::Length::Length
SWC_CAN_INLINE Length(FS::Statistics &stats, uint32_t timeout, const std::string &a_name, FS::Callback::LengthCb_t &&a_cb)
Definition: Length.h:22
SWC::Comm::Protocol::FsBroker::Req::Length::name
const std::string name
Definition: Length.h:45
Base.h
SWC::Comm::Protocol::FsBroker::Req::Base::error
int error
Definition: Base.h:23
SWC::Comm::Protocol::FsBroker::Req::Base::handle_length
void handle_length(const Event::Ptr &ev, const std::string &name, size_t &length)
Definition: Base.cc:280
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
Length.h
SWC::Comm::Protocol::FsBroker::FUNCTION_LENGTH
@ FUNCTION_LENGTH
Length.
Definition: Commands.h:34
SWC::Comm::Protocol::FsBroker::Handler::length
void length(const ConnHandlerPtr &conn, const Event::Ptr &ev)
Definition: Length.h:17
SWC::Comm::Buffers
Definition: Buffers.h:20
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition: AppContext.h:17
SWC::Comm::Protocol::FsBroker::Req::Length::~Length
~Length() noexcept
Definition: Length.h:36
SWC::Comm::Protocol::FsBroker::Req::Length::handle
void handle(ConnHandlerPtr, const Event::Ptr &ev) override
Definition: Length.h:38
SWC::Comm::Protocol::FsBroker::Req::Length
Definition: Length.h:17
SWC::Comm::Protocol::FsBroker::Req::Length::cb
const FS::Callback::LengthCb_t cb
Definition: Length.h:46
SWC::FS::Statistics
Definition: Statistics.h:18
SWC::Comm::Protocol::FsBroker::Req::Length::Ptr
std::shared_ptr< Length > Ptr
Definition: Length.h:19
SWC::Comm::Event::Ptr
std::shared_ptr< Event > Ptr
Definition: Event.h:33
SWC::Comm::Protocol::FsBroker::Req::Base
Definition: Base.h:17