 |
SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
|
Go to the documentation of this file.
6 #ifndef swcdb_manager_Schemas_h
7 #define swcdb_manager_Schemas_h
13 namespace SWC {
namespace Manager {
42 for(
auto it = entries.
cbegin(); it != entries.
cend(); ) {
43 blk_buff.
ensure((*it)->encoded_length());
44 (*it)->encode(&blk_buff.
ptr);
45 if(++it == entries.
cend() || blk_buff.
fill() >= blksz) {
60 fs_if->close(err, smartfd);
61 if(!err && (fs_if->length(err, smartfd->filepath()) !=
size || err)) {
74 if(!fs_if->exists(err, smartfd->filepath())) {
80 size_t length = fs_if->length(err, smartfd->filepath());
82 fs_if->open(err, smartfd);
83 auto& fs = fs_if->get_fs();
90 if(fs->pread(err, smartfd,
length - 8, buf, 8) != 8 ||
99 for(
size_t offset = 0; !err && offset <
length; ) {
119 if(fs->pread(err, smartfd, offset, &buffer, size_enc) != size_enc) {
128 if(
encoder != DB::Types::Encoder::PLAIN) {
132 buffer.
base, size_enc,
137 buffer.
set(decoded_buf);
147 return err ? false :
true;
177 encoder = DB::Types::Encoder::PLAIN;
180 uint8_t* ptr = output.
base;
181 const uint8_t* base = ptr;
188 *sizep += output.
fill();
210 #endif // swcdb_manager_Schemas_h
void store_make_block(int &err, uint64_t *sizep, DynamicBuffer &blk_buff, DB::Types::Encoder encoder, FS::SmartFd::Ptr &smartfd, bool last_blk)
void store_remove(FS::SmartFd::Ptr &smartfd)
bool store_load(int &err)
#define SWC_LOGF(priority, fmt,...)
SWC_CAN_INLINE void encode_i64(uint8_t **bufp, uint64_t val) noexcept
SWC_CAN_INLINE void encode_i32(uint8_t **bufp, uint32_t val) noexcept
static SWC_CAN_INLINE FS::Interface::Ptr & interface() noexcept
static SWC_CAN_INLINE Ptr make_ptr(const std::string &filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0)
void store_create(int &err, uint8_t replicas, uint32_t blksz, const DB::Types::Encoder cfg_encoder)
SWC_CAN_INLINE bool checksum_i32_chk(uint32_t checksum, const uint8_t *base, uint32_t len)
SWC_CAN_INLINE void ensure(size_t len)
constexpr SWC_CAN_INLINE void encode_i8(uint8_t **bufp, uint8_t val) noexcept
SWC_CAN_INLINE Schemas() noexcept
constexpr SWC_CAN_INLINE void clear() noexcept
void decode(int &err, Type encoder, const uint8_t *src, size_t sz_enc, uint8_t *dst, size_t sz)
void all(SchemasVec &entries)
The SWC-DB C++ namespace 'SWC'.
void replace(const Schema::Ptr &schema)
static SWC_CAN_INLINE Ptr make()
static SWC_CAN_INLINE FS::FileSystem::Ptr & fs() noexcept
void length(const ConnHandlerPtr &conn, const Event::Ptr &ev)
SWC_CAN_INLINE void free() noexcept
static constexpr const uint8_t BLOCK_HEADER_SIZE
Core::Encoder::Type Encoder
constexpr SWC_CAN_INLINE size_t fill() const noexcept
std::shared_ptr< SmartFd > Ptr
static constexpr const char schemas_file[]
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
SWC_CAN_INLINE void checksum_i32(const uint8_t *start, size_t len, uint8_t **ptr) noexcept
void encode(int &err, Type encoder, const uint8_t *src, size_t src_sz, size_t *sz_enc, DynamicBuffer &output, uint32_t reserve, bool no_plain_out=false, bool ok_more=false)
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
constexpr SWC_CAN_INLINE uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
void set(value_type *data, size_t len, bool take_ownership) noexcept