SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
CombiPread.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 #include "swcdb/fs/SmartFd.h"
9 
10 
11 namespace SWC { namespace Comm { namespace Protocol {
12 namespace FsBroker { namespace Params {
13 
14 
16  return Serialization::encoded_length_bytes(smartfd->filepath().size())
19 }
20 
21 void CombiPreadReq::internal_encode(uint8_t** bufp) const {
23  bufp, smartfd->filepath().c_str(), smartfd->filepath().size());
26 }
27 
28 void CombiPreadReq::internal_decode(const uint8_t** bufp, size_t* remainp) {
30  Serialization::decode_bytes_string(bufp, remainp), 0);
31  offset = Serialization::decode_vi64(bufp, remainp);
32  amount = Serialization::decode_vi32(bufp, remainp);
33 }
34 
35 
36 }}}}}
SWC::Serialization::encoded_length_bytes
constexpr SWC_CAN_INLINE size_t encoded_length_bytes(size_t len) noexcept
Definition: Serialization.h:537
SWC::Serialization::encoded_length_vi32
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi32(uint32_t val) noexcept
Definition: Serialization.h:234
SWC::FS::SmartFd::make_ptr
static SWC_CAN_INLINE Ptr make_ptr(const std::string &filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0)
Definition: SmartFd.h:40
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::amount
uint32_t amount
Definition: CombiPread.h:32
SWC::Serialization::encode_bytes
SWC_CAN_INLINE void encode_bytes(uint8_t **bufp, const void *data, size_t len)
Definition: Serialization.h:542
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::internal_encoded_length
size_t SWC_PURE_FUNC internal_encoded_length() const override
Definition: CombiPread.cc:15
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::smartfd
FS::SmartFd::Ptr smartfd
Definition: CombiPread.h:30
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Serialization::encoded_length_vi64
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi64(uint64_t val) noexcept
Definition: Serialization.h:272
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::offset
uint64_t offset
Definition: CombiPread.h:31
SmartFd.h
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::internal_decode
void internal_decode(const uint8_t **bufp, size_t *remainp) override
Definition: CombiPread.cc:28
SWC::Comm::Protocol::FsBroker::Params::CombiPreadReq::internal_encode
void internal_encode(uint8_t **bufp) const override
Definition: CombiPread.cc:21
SWC::Serialization::decode_bytes_string
SWC_CAN_INLINE std::string decode_bytes_string(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:558
CombiPread.h
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::Serialization::encode_vi64
constexpr SWC_CAN_INLINE void encode_vi64(uint8_t **bufp, uint64_t val)
Definition: Serialization.h:286
SWC::Serialization::decode_vi32
constexpr SWC_CAN_INLINE uint32_t decode_vi32(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:254