SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
RangeQueryUpdate.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 
6 
7 
8 #include "swcdb/core/Exception.h"
11 
12 
13 namespace SWC { namespace Comm { namespace Protocol {
14 namespace Rgr { namespace Params {
15 
16 
17 
18 void RangeQueryUpdateReq::print(std::ostream& out) const {
19  out << "RangeQueryUpdateReq(cid=" << cid << " rid=" << rid << ')';
20 }
21 
25 }
26 
27 void RangeQueryUpdateReq::internal_encode(uint8_t** bufp) const {
30 }
31 
32 void RangeQueryUpdateReq::internal_decode(const uint8_t** bufp,
33  size_t* remainp) {
34  cid = Serialization::decode_vi64(bufp, remainp);
35  rid = Serialization::decode_vi64(bufp, remainp);
36 }
37 
38 
39 
41  const uint8_t* ptr,
42  size_t remain) noexcept
43  : err(a_err), cells_added(0),
44  range_prev_end(), range_end() {
45  if(!err) try {
46  decode(&ptr, &remain);
47  } catch(...) {
49  err = e.code();
51  }
52 }
53 
54 void RangeQueryUpdateRsp::print(std::ostream& out) const {
55  Error::print(out << "RangeQueryUpdateRsp(", err);
56  out << " cells_added=" << cells_added;
58  if(!range_prev_end.empty())
59  range_prev_end.print(out << " range_prev_end=");
60  if(!range_end.empty())
61  range_end.print(out << " range_end=");
62  }
63  out << ')';
64 }
65 
71  : 0);
72 }
73 
74 void RangeQueryUpdateRsp::internal_encode(uint8_t** bufp) const {
78  range_prev_end.encode(bufp);
79  range_end.encode(bufp);
80  }
81 }
82 
83 void RangeQueryUpdateRsp::internal_decode(const uint8_t** bufp,
84  size_t* remainp) {
85  err = Serialization::decode_vi32(bufp, remainp);
86  cells_added = Serialization::decode_vi32(bufp, remainp);
88  range_prev_end.decode(bufp, remainp, false);
89  range_end.decode(bufp, remainp, false);
90  }
91 }
92 
93 
94 
95 }}}}}
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::internal_encoded_length
size_t SWC_PURE_FUNC internal_encoded_length() const override
Definition: RangeQueryUpdate.cc:66
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::Params::RangeQueryUpdateReq::internal_decode
void internal_decode(const uint8_t **bufp, size_t *remainp) override
Definition: RangeQueryUpdate.cc:32
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateReq::internal_encode
void internal_encode(uint8_t **bufp) const override
Definition: RangeQueryUpdate.cc:27
SWC::Serialization::encoded_length_vi32
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi32(uint32_t val) noexcept
Definition: Serialization.h:234
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateReq::cid
cid_t cid
Definition: RangeQueryUpdate.h:33
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateReq::print
void print(std::ostream &out) const
Definition: RangeQueryUpdate.cc:18
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::internal_encode
void internal_encode(uint8_t **bufp) const override
Definition: RangeQueryUpdate.cc:74
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateReq::internal_encoded_length
size_t SWC_PURE_FUNC internal_encoded_length() const override
Definition: RangeQueryUpdate.cc:22
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::cells_added
uint32_t cells_added
Definition: RangeQueryUpdate.h:65
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::internal_decode
void internal_decode(const uint8_t **bufp, size_t *remainp) override
Definition: RangeQueryUpdate.cc:83
SWC::DB::Cell::Key::decode
void decode(const uint8_t **bufp, size_t *remainp, bool owner)
Definition: CellKey.h:337
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::RangeQueryUpdateRsp
SWC_CAN_INLINE RangeQueryUpdateRsp(int a_err=Error::OK) noexcept
Definition: RangeQueryUpdate.h:52
SWC::DB::Cell::Key::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: CellKey.h:186
decode
void decode(const uint8_t **bufp, size_t *remainp)
Definition: HeaderBufferInfo.h:33
Exception.h
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::range_prev_end
DB::Cell::Key range_prev_end
Definition: RangeQueryUpdate.h:66
RangeQueryUpdate.h
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
Serialization.h
SWC::Serialization::encoded_length_vi64
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi64(uint64_t val) noexcept
Definition: Serialization.h:272
SWC::DB::Cell::Key::encoded_length
constexpr uint32_t encoded_length() const noexcept
Definition: CellKey.h:323
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateReq::rid
rid_t rid
Definition: RangeQueryUpdate.h:34
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::print
void print(std::ostream &out) const
Definition: RangeQueryUpdate.cc:54
SWC::Serialization::decode_vi64
constexpr SWC_CAN_INLINE uint64_t decode_vi64(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:302
SWC::Serialization::encode_vi32
constexpr SWC_CAN_INLINE void encode_vi32(uint8_t **bufp, uint32_t val)
Definition: Serialization.h:243
SWC::DB::Cell::Key::print
void print(std::ostream &out) const
Definition: CellKey.cc:182
SWC::Serialization::encode_vi64
constexpr SWC_CAN_INLINE void encode_vi64(uint8_t **bufp, uint64_t val)
Definition: Serialization.h:286
SWC::Error::RANGE_BAD_INTERVAL
@ RANGE_BAD_INTERVAL
Definition: Error.h:119
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::err
int32_t err
Definition: RangeQueryUpdate.h:64
SWC::Error::print
void print(std::ostream &out, int err)
Definition: Error.cc:191
SWC::Error::Exception
Definition: Exception.h:21
SWC::DB::Cell::Key::encode
void encode(uint8_t **bufp) const
Definition: CellKey.h:328
SWC::Comm::Protocol::Rgr::Params::RangeQueryUpdateRsp::range_end
DB::Cell::Key range_end
Definition: RangeQueryUpdate.h:67
SWC::Serialization::decode_vi32
constexpr SWC_CAN_INLINE uint32_t decode_vi32(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:254