|
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.
10 namespace SWC {
namespace Ranger {
namespace CellStore {
23 intval.
expand(cs->interval);
27 for(
auto cs : *
this) {
28 intval.
expand(cs->interval);
29 intval.
align(cs->interval);
36 sz += cs->size_bytes(only_loaded);
42 return front()->cell_revs;
50 ts = cs->interval.ts_earliest.value;
58 sz += cs->blocks_count();
65 for(
auto cs : *
this) {
66 released += cs->release(bytes - released);
101 for(
auto cs : *
this) {
103 cs->load_cells(loader);
104 }
else if(!cs->interval.key_end.empty() &&
114 for(
auto cs : *
this) {
115 cs->get_blocks(err, to);
132 size_t blk_size)
const {
133 if(cs_max > 1 &&
size() > cs_max) {
136 for(
auto it =
cbegin() + 1; it <
cend(); ++it) {
137 if(!(*it)->prev_key_end.equal((*it)->interval.key_begin))
143 for(
auto cs : *
this) {
144 if(!(sz_enc = cs->size_bytes_enc(
false)) || !(sz = cs->size_bytes(
false)))
146 if(sz_enc > cs_sz || sz/cs->blocks_count() > blk_size)
154 for(
auto cs : *
this) {
162 for(
auto cs : *
this) {
172 for(
size_t i=0; i<len; ++i) {
186 if(fs_if->exists(err, bak_path)) {
189 "Backup dir='%s' has remained - Recovering from uncomplete Compaction, "
190 "backing-up current to='%s'", bak_path.c_str(), rcvd_path.c_str());
191 if(fs_if->exists(err, cs_path))
192 fs_if->rename(err, cs_path, rcvd_path);
195 fs_if->rename(err, bak_path, cs_path);
201 fs_if->readdir(err, cs_path, dirs);
207 for(
auto& entry : dirs) {
208 if(entry.name.find(
".cs", entry.name.length()-3) != std::string::npos) {
209 auto idn = entry.name.substr(0, entry.name.length()-3);
210 entries.
push_back(strtoull(idn.c_str(),
nullptr, 0));
219 for(
csid_t csid : entries) {
232 fs_if->rename(err, cs_path, bak_path);
241 for(
auto cs : w_cellstores) {
247 for(
auto cs : cellstores)
256 fs_if->rmdir(err, cs_path);
257 fs_if->rename(err, bak_path, cs_path);
261 fs_if->rmdir(err, bak_path);
273 for(
auto cs : mv_css) {
278 range->get_path_cs(cs->csid)
288 for(
auto cs : moved) {
296 for(
auto cs : cellstores)
299 for(
auto& cs : moved) {
302 range->get_path_cs(cs->csid),
313 out <<
"CellStores(count=" <<
size()
315 for(
auto cs : *
this) {
316 cs->print(out, minimal);
326 for(
auto cs : *
this) {
uint32_t SWC_PURE_FUNC encoded_length() const
constexpr SWC_CAN_INLINE reference front() noexcept
static constexpr const char CELLSTORES_RCVD_DIR[]
void expand(DB::Cells::Interval &intval) const
#define SWC_LOGF(priority, fmt,...)
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
SWC_CAN_INLINE Vector & operator=(Vector &&other) noexcept
SWC_CAN_INLINE bool align(const Interval &other)
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi32(uint32_t val) noexcept
static SWC_CAN_INLINE FS::Interface::Ptr & interface() noexcept
int64_t SWC_PURE_FUNC get_ts_earliest() const
constexpr const int64_t TIMESTAMP_AUTO
void expand(const Interval &other)
bool is_in_end(const DB::Cell::Key &key) const
void expand_and_align(DB::Cells::Interval &intval) const
@ SERIALIZATION_INPUT_OVERRUN
bool SWC_PURE_FUNC need_compaction(size_t cs_max, size_t cs_sz, size_t blk_size) const
size_t size_bytes(bool only_loaded=false) const
constexpr SWC_CAN_INLINE bool empty() const noexcept
constexpr SWC_CAN_INLINE reference back() noexcept
constexpr SWC_CAN_INLINE iterator end() noexcept
The SWC-DB C++ namespace 'SWC'.
void print(std::ostream &out, bool minimal=true) const
static constexpr const char CELLSTORES_BAK_DIR[]
size_t release(size_t bytes)
static Ptr make(int &err, const csid_t csid, const RangePtr &range, bool chk_base=false)
void load_from_path(int &err)
void copy(const Key &other)
void move_from(int &err, Readers::Vec &mv_css)
static constexpr const char CELLSTORES_TMP_DIR[]
static constexpr const char CELLSTORES_DIR[]
void get_blocks(int &err, Read::Blocks &to) const
void decode(int &err, const uint8_t **ptr, size_t *remain)
void sort(const Networks &nets, const EndPoints &endpoints, EndPoints &sorted)
void replace(int &err, Writers &w_cellstores)
SWC_CAN_INLINE void shrink_to_fit(size_type sz=0)
void get_key_end(DB::Cell::Key &key) const
SWC_CAN_INLINE void reserve()
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
bool is_consist(const DB::Cells::Interval &intval) const
constexpr SWC_CAN_INLINE void encode_vi32(uint8_t **bufp, uint32_t val)
void encode(uint8_t **ptr) const
bool processing() const noexcept
uint32_t get_cell_revs() const
void load_cells(BlockLoader *loader)
SWC_CAN_INLINE void push_back(ArgsT &&... args)
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
size_t blocks_count() const
constexpr SWC_CAN_INLINE size_type size() const noexcept
void get_prev_key_end(uint32_t idx, DB::Cell::Key &key) const
SWC_CAN_INLINE void reserve(size_type cap)
constexpr SWC_CAN_INLINE uint32_t decode_vi32(const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE iterator begin() noexcept