 |
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.
9 namespace SWC {
namespace Ranger {
16 m_mutex(), m_q_mng(), m_release() {
43 return it == cend() ? nullptr : it->second;
49 auto it = find(last_rid);
52 last_rid = it->second->rid;
62 for(
size_t i=idx; i; --i, ++it);
63 last_rid = it->second->rid;
74 for(
auto it = cbegin(); it != cend(); ++it)
81 for(
auto it = cbegin(); it != cend(); ++it)
89 cfg->c_ttl > uint64_t(schema.
cell_ttl) * 1000000000;
92 cfg->c_ttl != uint64_t(schema.
cell_ttl) * 1000000000;
96 for(
auto it = cbegin(); it != cend(); ++it)
97 it->second->schema_update(
compact);
106 for(
auto it = cbegin(); it != cend(); ++it)
107 it->second->compact_require(
true);
121 for(
size_t offset = 0; ; ++offset) {
126 if(range && (it = find(range->rid)) != cend()) {
130 for(
size_t i=0; i<offset && it != cend(); ++it, ++i);
136 if(!range->is_loaded() || range->compacting())
138 released += range->blocks.release(bytes - released, level);
139 if(released >= bytes)
148 cfg->print(out <<
'(');
151 for(
auto it = cbegin(); it != cend(); ++it){
152 it->second->print(out, minimal);
165 }
else if(
cfg->deleting) {
171 auto res = emplace(rid,
nullptr);
173 res.first->second.reset(
new Range(
cfg, rid));
174 res.first->second->init();
178 return res.first->second;
184 bool chk_empty =
false;
185 range->internal_unload(
true, chk_empty);
194 range->internal_unload(
true, chk_empty);
203 range->internal_remove(err);
222 noexcept :
ptr(std::move(a_ptr)),
req(std::move(a_req)) {
226 :
ptr(std::move(other.ptr)),
req(std::move(other.req)) {
233 switch(
req->action) {
236 std::dynamic_pointer_cast<Callback::RangeLoad>(
req));
242 std::dynamic_pointer_cast<Callback::RangeUnload>(
req));
248 std::dynamic_pointer_cast<Callback::RangeUnloadInternal>(
req));
254 std::dynamic_pointer_cast<Callback::ColumnsUnload>(
req));
260 std::dynamic_pointer_cast<Callback::ColumnDelete>(
req));
287 if(req->expired(1000))
292 req->col = shared_from_this();
293 err ? req->loaded(err) : range->load(req);
297 if(req->expired(1000))
300 bool chk_empty =
true;
303 req->rsp_params.set_empty();
304 req->response_params();
311 bool chk_empty =
false;
325 range = cbegin()->second;
328 bool chk_empty =
false;
329 range->internal_unload(req->completely, chk_empty);
330 req->unloaded(range);
334 req->unloaded(shared_from_this());
340 if(req->expired(1000))
344 return req->response_ok();
346 cfg->deleting.store(
true);
351 for(
auto it=cbegin(); it != cend(); ++it) {
352 req->add(it->second);
356 req->col = shared_from_this();
360 for(
auto& range : ranges)
void internal_unload(const rid_t rid)
Column(const cid_t cid, const DB::SchemaPrimitives &schema)
constexpr SWC_CAN_INLINE void stop() noexcept
Core::QueueSafeStated< Callback::ManageBase::Ptr > m_q_mng
size_t ranges_count() noexcept
static void compaction_schedule(uint32_t ms)
std::shared_ptr< ColumnsUnload > Ptr
SWC_CAN_INLINE TaskRunMngReq(ColumnPtr &&a_ptr, Callback::ManageBase::Ptr &&a_req) noexcept
~TaskRunMngReq() noexcept
TaskRunMngReq & operator=(TaskRunMngReq &&)=delete
Callback::ManageBase::Ptr req
constexpr SWC_CAN_INLINE bool is_data(cid_t cid) noexcept
void print(std::ostream &out, bool minimal=true)
static SWC_CAN_INLINE Ranger::Columns * columns() noexcept
void internal_delete(rid_t rid)
void load(const Callback::RangeLoad::Ptr &req)
Core::StateRunning m_release
SWC_CAN_INLINE TaskRunMngReq(TaskRunMngReq &&other) noexcept
void add_managing(Callback::ManageBase::Ptr &&req)
RangePtr get_next(cid_t &last_rid, size_t &idx)
std::shared_ptr< Column > ColumnPtr
std::shared_ptr< RangeUnload > Ptr
std::shared_ptr< RangeUnloadInternal > Ptr
void erase_if_empty(cid_t cid)
constexpr SWC_CAN_INLINE bool empty() const noexcept
std::shared_ptr< Range > RangePtr
The SWC-DB C++ namespace 'SWC'.
static SWC_CAN_INLINE int64_t in_process() noexcept
void schema_update(const DB::SchemaPrimitives &schema)
RangePtr internal_create(int &err, rid_t rid, bool compacting)
constexpr SWC_CAN_INLINE bool running() noexcept
SWC_CAN_INLINE bool deactivating()
RangePtr get_range(const rid_t rid)
void get_rids(rids_t &rids)
bool is_not_used() noexcept
std::shared_ptr< ManageBase > Ptr
static const uint8_t COMPACT_APPLYING
void remove(const Callback::ColumnDelete::Ptr &req)
SWC_CAN_INLINE bool empty() noexcept
std::shared_ptr< ColumnDelete > Ptr
static SWC_CAN_INLINE bool is_shuttingdown() noexcept
void unload_all(const Callback::ColumnsUnload::Ptr &req)
std::shared_ptr< RangeLoad > Ptr
static SWC_CAN_INLINE bool is_not_accepting() noexcept
TaskRunMngReq & operator=(const TaskRunMngReq &)=delete
SWC_CAN_INLINE bool activating() noexcept
static SWC_CAN_INLINE void post(T_Handler &&handler)
size_t release(size_t bytes, uint8_t level)
void get_ranges(Core::Vector< RangePtr > &ranges)
SWC_CAN_INLINE void push_back(ArgsT &&... args)
void unload(const Callback::RangeUnload::Ptr &req)
void internal_remove(int &err, const rid_t rid)
TaskRunMngReq(const TaskRunMngReq &)=delete
SWC_CAN_INLINE void reserve(size_type cap)