SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Seek.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_params_Seek_h
7 #define swcdb_fs_Broker_Protocol_params_Seek_h
8 
9 
11 
12 
13 namespace SWC { namespace Comm { namespace Protocol {
14 namespace FsBroker { namespace Params {
15 
16 
17 class SeekReq final : public Serializable {
18  public:
19 
21  SeekReq() noexcept : fd(-1), offset() { }
22 
24  SeekReq(int32_t a_fd, size_t a_offset) noexcept
25  : fd(a_fd), offset(a_offset) { }
26 
27  int32_t fd;
28  uint64_t offset;
29 
30  private:
31 
32  size_t SWC_PURE_FUNC internal_encoded_length() const override;
33 
34  void internal_encode(uint8_t** bufp) const override;
35 
36  void internal_decode(const uint8_t** bufp, size_t* remainp) override;
37 
38 };
39 
40 
41 
42 
43 class SeekRsp final : public Serializable {
44  public:
45 
47  SeekRsp() noexcept: offset() { }
48 
50  SeekRsp(size_t a_offset) noexcept : offset(a_offset) { }
51 
52  uint64_t offset;
53 
54  private:
55 
56  size_t SWC_PURE_FUNC internal_encoded_length() const override;
57 
58  void internal_encode(uint8_t** bufp) const override;
59 
60  void internal_decode(const uint8_t** bufp, size_t* remainp) override;
61 
62 };
63 
64 }}}}}
65 
66 
67 #if defined(SWC_IMPL_SOURCE) or \
68  (defined(FS_BROKER_APP) and !defined(BUILTIN_FS_BROKER))
70 #endif
71 
72 
73 #endif // swcdb_fs_Broker_Protocol_params_Seek_h
SWC::Comm::Protocol::FsBroker::Params::SeekRsp
Definition: Seek.h:43
SWC::Comm::Protocol::FsBroker::Params::SeekReq::internal_encode
void internal_encode(uint8_t **bufp) const override
Definition: Seek.cc:19
Seek.cc
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::offset
uint64_t offset
Definition: Seek.h:52
SWC::Comm::Protocol::FsBroker::Params::SeekReq
Definition: Seek.h:17
SWC::Comm::Protocol::FsBroker::Params::SeekReq::offset
uint64_t offset
Definition: Seek.h:28
SWC::Comm::Protocol::FsBroker::Params::SeekReq::SeekReq
SWC_CAN_INLINE SeekReq() noexcept
Definition: Seek.h:21
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::FsBroker::Params::SeekReq::SeekReq
SWC_CAN_INLINE SeekReq(int32_t a_fd, size_t a_offset) noexcept
Definition: Seek.h:24
SWC_PURE_FUNC
#define SWC_PURE_FUNC
Definition: Compat.h:108
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::internal_decode
void internal_decode(const uint8_t **bufp, size_t *remainp) override
Definition: Seek.cc:39
SWC::Comm::Serializable
Definition: Serializable.h:18
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::internal_encoded_length
size_t SWC_PURE_FUNC internal_encoded_length() const override
Definition: Seek.cc:31
Serializable.h
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::SeekRsp
SWC_CAN_INLINE SeekRsp(size_t a_offset) noexcept
Definition: Seek.h:50
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::SeekRsp
SWC_CAN_INLINE SeekRsp() noexcept
Definition: Seek.h:47
SWC::Comm::Protocol::FsBroker::Params::SeekReq::fd
int32_t fd
Definition: Seek.h:27
SWC::Comm::Protocol::FsBroker::Params::SeekRsp::internal_encode
void internal_encode(uint8_t **bufp) const override
Definition: Seek.cc:35
SWC::Comm::Protocol::FsBroker::Params::SeekReq::internal_decode
void internal_decode(const uint8_t **bufp, size_t *remainp) override
Definition: Seek.cc:24
SWC::Comm::Protocol::FsBroker::Params::SeekReq::internal_encoded_length
size_t SWC_PURE_FUNC internal_encoded_length() const override
Definition: Seek.cc:14