|
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.
12 namespace SWC {
namespace Ranger {
24 : blocks(a_blocks), next(nullptr), prev(nullptr),
28 blocks->range->cfg->key_seq,
29 blocks->range->cfg->cell_versions(),
30 blocks->range->cfg->cell_ttl(),
31 blocks->range->cfg->column_type())),
32 m_releasable_bytes(0),
35 m_prev_key_end(), m_key_end(interval.key_end),
37 m_processing(0), m_state(state), m_loader(nullptr) {
40 sizeof(*
this) +
sizeof(
Ptr));
155 Task(
Block* a_blk) noexcept
156 : blk(a_blk), sz(blk->
blocks->
range->cfg->block_size()) {
192 for(
auto cells : vec_cells) {
208 SWC_SHOULD_NOT_INLINE
210 uint32_t revs,
size_t avail,
211 bool& was_splitted,
bool synced) {
214 size_t offset_hint = 0;
225 cell.read(&buf, &remain,
false);
244 if(!(++added % 1000) &&
splitter(
false)) {
253 << count <<
'/' << avail <<
" remain=" << remain;
286 case State::LOADED: {
294 proceed:
switch(req->type) {
295 case ReqScan::Type::BLK_PRELOAD: {
297 return ScanState::RESPONDED;
300 return _scan(req,
true);
307 switch(q.req->type) {
308 case ReqScan::Type::BLK_PRELOAD: {
318 : blk(a_blk), req(std::move(a_req)) { }
320 Task(Task&& other) noexcept
321 : blk(other.blk), req(std::move(other.req)) { }
322 Task(
const Task&) =
delete;
326 void operator()() { blk->
_scan(req); }
329 q.req->profile.add_block_load(
337 q.req->response(err);
406 auto at(State::LOADED);
433 return m_state == State::LOADED;
508 out <<
"CellsLocked";
518 if(req->has_update()) {
531 req->profile.add_block_scan(ts);
535 if(err || req->reached_limits()) {
536 if(req->with_block())
540 return ScanState::RESPONDED;
543 if(req->release_block)
549 return ScanState::SYNCED;
std::shared_mutex m_mutex
SWC_CAN_INLINE void add_raw(const DynamicBuffer &cells, bool finalized)
constexpr SWC_CAN_INLINE bool compare_exchange_weak(T &at, T value) noexcept
constexpr SWC_CAN_INLINE Cell & back() noexcept
static SWC_CAN_INLINE System::Resources & res() noexcept
bool includes_end(const DB::Specs::Interval &spec) const
constexpr SWC_CAN_INLINE int code() const noexcept
bool is_next(const DB::Specs::Interval &spec) const
constexpr SWC_CAN_INLINE size_t size() const noexcept
static Ptr make(const DB::Cells::Interval &interval, Blocks *blocks, State state=State::NONE)
size_t load_cells(const uint8_t *buf, size_t remain, uint32_t revs, size_t avail, bool &was_splitted, bool synced=false)
bool processing() noexcept
#define SWC_LOG_OUT(pr, _code_)
SWC_CAN_INLINE int64_t now_ns() noexcept
constexpr SWC_CAN_INLINE bool is_data(cid_t cid) noexcept
std::queue< ReqQueue > q_req
void schema_update() noexcept
void configure(const uint32_t revs, const uint64_t ttl_ns, const Types::Column typ, bool finalized)
void processing_increment() noexcept
SWC_CAN_INLINE void more_mem_future(size_t sz) noexcept
bool add_logged(const DB::Cells::Cell &cell)
const char *SWC_CONST_FUNC to_string(Column typ) noexcept
void add(const ReqScan::Ptr &req)
Core::Atomic< size_t > m_releasable_bytes
bool includes(const DB::Specs::Interval &spec) const
ScanState _scan(const ReqScan::Ptr &req, bool synced=false)
bool _is_in_end(const DB::Cell::Key &key) const
SWC_CAN_INLINE void unlock(const bool &support) noexcept
bool is_in_end(const DB::Cell::Key &key) const
std::shared_ptr< ReqScanBlockLoader > Ptr
void print(std::ostream &out) const
ScanState scan(const ReqScan::Ptr &req)
bool is_in_previous(const Types::KeySeq key_seq, const DB::Cell::Key &prev) const
SWC_CAN_INLINE void add_sorted(const Cell &cell, bool no_value=false)
constexpr SWC_CAN_INLINE bool empty() const noexcept
DB::Cell::Key m_prev_key_end
constexpr SWC_CAN_INLINE void store(T v) noexcept
Block(const DB::Cells::Interval &interval, Blocks *blocks, State state=State::NONE)
SWC_CAN_INLINE void more_mem_releasable(size_t sz) noexcept
SWC_CAN_INLINE void scan(ReqScan *req) const
Core::Atomic< State > m_state
void processing_decrement()
SWC_CAN_INLINE void less_mem_releasable(size_t sz) noexcept
Condition::Comp _cond_key_end(const DB::Cell::Key &key) const
#define SWC_CURRENT_EXCEPTION(_msg_)
bool splitter(bool loaded)
The SWC-DB C++ namespace 'SWC'.
bool _split(Block::Ptr blk, bool loaded)
SWC_CAN_INLINE void free() noexcept
Core::MutexAtomic m_mutex_intval
void copy(const Key &other)
SWC_CAN_INLINE void adj_mem_releasable(ssize_t sz) noexcept
size_t size_of_internal()
DB::Cells::Mutable m_cells
bool is_matching_begin(const Types::KeySeq key_seq, const DB::Cell::Key &key) const
constexpr SWC_CAN_INLINE bool empty() const noexcept
void scan(ReqScan::Ptr req, Block::Ptr blk_ptr=nullptr)
SWC_CAN_INLINE void less_mem_future(size_t sz) noexcept
bool _includes_begin(const DB::Specs::Interval &spec) const
bool loaded() const noexcept
constexpr SWC_CAN_INLINE size_t size_of_internal() const noexcept
constexpr SWC_CAN_INLINE T exchange(T value) noexcept
void print(std::ostream &out, bool with_cells=false) const
size_t _size() const noexcept
SWC_CAN_INLINE void free() noexcept
void print(std::ostream &out)
const Types::KeySeq key_seq
constexpr SWC_CAN_INLINE bool has_one_key() const noexcept
Core::MutexSptd m_mutex_state
constexpr SWC_CAN_INLINE T load() const noexcept
bool is_consist(const DB::Cells::Interval &intval) const
void _set_key_end(const DB::Cell::Key &key)
void processing_decrement() noexcept
Core::Atomic< size_t > m_processing
SWC_CAN_INLINE void finalize_raw()
bool need_load() const noexcept
void print(std::ostream &out) const
Block & operator=(const Block &)=delete
static SWC_CAN_INLINE void post(T_Handler &&handler)
constexpr SWC_CAN_INLINE size_t size_bytes() const noexcept
void move(Key &other) noexcept
constexpr SWC_CAN_INLINE T fetch_sub(T v) noexcept
constexpr SWC_CAN_INLINE T fetch_add(T v) noexcept
SWC_CAN_INLINE bool split(Mutable &cells, size_t count, size_t bytes, bool loaded)
bool try_full_lock(bool &support) noexcept
std::shared_ptr< ReqScan > Ptr
void load_final(const DB::Cells::MutableVec &cells)
bool _need_split() const noexcept
size_t _releasing_size() const noexcept
Condition::Comp compare(const Types::KeySeq seq, const Cell::Key &key, const Cell::Key &other) SWC_ATTRIBS((SWC_ATTRIB_O3))
void _set_prev_key_end(const DB::Cell::Key &key)