SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::Manager::Column Class Referencefinal

#include <swcdb/manager/db/Column.h>

+ Inheritance diagram for SWC::Manager::Column:
+ Collaboration diagram for SWC::Manager::Column:

Public Types

using State = DB::Types::MngrColumn::State
 
typedef std::shared_ptr< ColumnPtr
 

Public Member Functions

SWC_CAN_INLINE Column (const DB::Schema::Ptr &schema)
 
 ~Column () noexcept
 
void init (int &err)
 
void set_loading ()
 
void set_unloaded (const Range::Ptr &range)
 
bool set_merging (const Range::Ptr &range)
 
SWC_CAN_INLINE State state ()
 
SWC_CAN_INLINE State _state ()
 
SWC_CAN_INLINE void state (int &err)
 
size_t ranges ()
 
void assigned (rgrid_t rgrid, size_t &num, Core::Vector< Range::Ptr > &_ranges)
 
void get_ranges (Core::Vector< Range::Ptr > &_ranges)
 
Range::Ptr get_range (const rid_t rid)
 
Range::Ptr get_range (int &, const DB::Cell::Key &range_begin, const DB::Cell::Key &range_end, bool next_range)
 
void sort (Range::Ptr &range, const DB::Cells::Interval &interval, int64_t revision)
 
Range::Ptr left_sibling (const Range::Ptr &right)
 
Range::Ptr create_new_range (rgrid_t rgrid)
 
rid_t get_next_rid ()
 
Range::Ptr get_next_unassigned ()
 
void set_rgr_unassigned (rgrid_t rgrid)
 
void change_rgr (rgrid_t rgrid_old, rgrid_t rgrid)
 
void change_rgr_schema (const rgrid_t rgrid, int64_t rev=0)
 
void remove_rgr_schema (const rgrid_t rgrid)
 
void need_schema_sync (int64_t rev, Core::Vector< rgrid_t > &rgrids)
 
bool need_schema_sync (const rgrid_t rgrid, int64_t rev)
 
void assigned (Core::Vector< rgrid_t > &rgrids)
 
void reset_health_check ()
 
bool need_health_check (int64_t ts, uint32_t ms)
 
void need_health_check (int64_t ts, uint32_t ms, Core::Vector< Range::Ptr > &_ranges, rgrid_t rgrid=0, size_t max=0)
 
void remove_range (rid_t rid)
 
bool do_remove ()
 
bool finalize_remove (int &err, rgrid_t rgrid=0)
 
void print (std::ostream &out)
 

Static Public Member Functions

static bool create (int &err, const cid_t cid)
 
static bool remove (int &err, const cid_t cid)
 

Public Attributes

const ColumnCfg::Ptr cfg
 

Private Member Functions

void _print (std::ostream &out)
 
SWC_CAN_INLINE void _set_loading ()
 
rid_t SWC_PURE_FUNC _get_next_rid () const noexcept
 
void _remove_rgr_schema (const rgrid_t rgrid)
 
void apply_loaded_state ()
 
- Private Member Functions inherited from SWC::Core::Vector< Range::Ptr >
constexpr SWC_CAN_INLINE Vector () noexcept
 
SWC_CAN_INLINE Vector (size_type sz, ArgsT &&... args)
 
constexpr SWC_CAN_INLINE Vector (Vector &&other) noexcept
 
SWC_CAN_INLINE Vector (const Vector &other)
 
SWC_CAN_INLINE Vector (const_iterator _b, const_iterator _e)
 
SWC_CAN_INLINE Vector (std::initializer_list< value_type > &&l)
 
SWC_CAN_INLINE ~Vector () noexcept(_NoExceptDestructor)
 
SWC_CAN_INLINE void clear () noexcept(_NoExceptDestructor)
 
SWC_CAN_INLINE void free () noexcept
 
SWC_CAN_INLINE Vectoroperator= (Vector &&other) noexcept
 
SWC_CAN_INLINE Vectoroperator= (const Vector &other)
 
SWC_CAN_INLINE void swap (Vector &other) noexcept
 
constexpr SWC_CAN_INLINE bool empty () const noexcept
 
constexpr SWC_CAN_INLINE bool operator== (const Vector &other) const noexcept
 
constexpr SWC_CAN_INLINE bool operator!= (const Vector &other) const noexcept
 
constexpr SWC_CAN_INLINE size_type size () const noexcept
 
constexpr SWC_CAN_INLINE size_type capacity () const noexcept
 
constexpr SWC_CAN_INLINE pointer data () noexcept
 
constexpr SWC_CAN_INLINE const_pointer data () const noexcept
 
constexpr SWC_CAN_INLINE iterator begin () noexcept
 
constexpr SWC_CAN_INLINE const_iterator begin () const noexcept
 
constexpr SWC_CAN_INLINE const_iterator cbegin () const noexcept
 
constexpr SWC_CAN_INLINE iterator end () noexcept
 
constexpr SWC_CAN_INLINE const_iterator end () const noexcept
 
constexpr SWC_CAN_INLINE const_iterator cend () const noexcept
 
constexpr SWC_CAN_INLINE reference front () noexcept
 
constexpr SWC_CAN_INLINE const_reference front () const noexcept
 
constexpr SWC_CAN_INLINE reference back () noexcept
 
constexpr SWC_CAN_INLINE const_reference back () const noexcept
 
constexpr SWC_CAN_INLINE reference operator[] (size_type pos) noexcept
 
constexpr SWC_CAN_INLINE const_reference operator[] (size_type pos) const noexcept
 
SWC_CAN_INLINE void shrink_to_fit (size_type sz=0)
 
SWC_CAN_INLINE void reserve (size_type cap)
 
SWC_CAN_INLINE void reserve ()
 
SWC_CAN_INLINE void resize (size_type sz, ArgsT &&... args)
 
SWC_CAN_INLINE void push_back (ArgsT &&... args)
 
SWC_CAN_INLINE void push_back_unsafe (ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE reference emplace_back (ArgsT &&... args)
 
SWC_CAN_INLINE reference emplace_back_unsafe (ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE iterator insert (size_type offset, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert (const_iterator it, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert (size_type offset, const_iterator first, const_iterator last)
 
SWC_CAN_INLINE iterator insert (const_iterator it, const_iterator first, const_iterator last)
 
SWC_CAN_INLINE reference emplace (const_iterator it, ArgsT &&... args)
 
SWC_CAN_INLINE iterator insert_unsafe (const_iterator it, ArgsT &&... args) noexcept(_NoExceptMove &&_NoExceptDestructor &&std::is_nothrow_constructible_v< value_type, ArgsT... >)
 
SWC_CAN_INLINE void assign (IteratorT first, IteratorT last)
 
SWC_CAN_INLINE iterator erase (size_type offset) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE iterator erase (const_iterator it) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE iterator erase (const_iterator first, const_iterator last) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
 
SWC_CAN_INLINE void pop_back () noexcept(_NoExceptDestructor)
 

Private Attributes

std::shared_mutex m_mutex
 
Core::Atomic< Statem_state
 
int64_t m_check_ts
 
std::unordered_map< rgrid_t, int64_t > m_schemas_rev
 

Additional Inherited Members

- Private Types inherited from SWC::Core::Vector< Range::Ptr >
using value_type = Range::Ptr
 
using size_type = uint32_t
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typeiterator
 
typedef const value_typeconst_iterator
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
- Static Private Member Functions inherited from SWC::Core::Vector< Range::Ptr >
constexpr static SWC_CAN_INLINE size_type max_size () noexcept
 

Detailed Description

Definition at line 18 of file Column.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<Column> SWC::Manager::Column::Ptr

Definition at line 24 of file Column.h.

◆ State

Constructor & Destructor Documentation

◆ Column()

SWC_CAN_INLINE SWC::Manager::Column::Column ( const DB::Schema::Ptr schema)
inline

Definition at line 43 of file Column.h.

◆ ~Column()

SWC::Manager::Column::~Column ( )
inlinenoexcept

Definition at line 49 of file Column.h.

Member Function Documentation

◆ _get_next_rid()

rid_t SWC_PURE_FUNC SWC::Manager::Column::_get_next_rid ( ) const
inlineprivatenoexcept

Definition at line 385 of file Column.h.

Referenced by _print(), create_new_range(), and get_next_rid().

+ Here is the caller graph for this function:

◆ _print()

void SWC::Manager::Column::_print ( std::ostream &  out)
inlineprivate

Definition at line 367 of file Column.h.

References _get_next_rid(), and cfg.

Referenced by finalize_remove(), and print().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _remove_rgr_schema()

void SWC::Manager::Column::_remove_rgr_schema ( const rgrid_t  rgrid)
inlineprivate

Definition at line 401 of file Column.h.

References m_schemas_rev.

Referenced by remove_rgr_schema(), and set_rgr_unassigned().

+ Here is the caller graph for this function:

◆ _set_loading()

SWC_CAN_INLINE void SWC::Manager::Column::_set_loading ( )
inlineprivate

Definition at line 379 of file Column.h.

References SWC::Core::AtomicBase< T, OrderT >::compare_exchange_weak(), SWC::DB::Types::MngrColumn::LOADING, m_check_ts, m_state, and SWC::Error::OK.

Referenced by get_next_unassigned(), set_loading(), set_rgr_unassigned(), and set_unloaded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _state()

SWC_CAN_INLINE State SWC::Manager::Column::_state ( )
inline

Definition at line 80 of file Column.h.

References m_state.

◆ apply_loaded_state()

void SWC::Manager::Column::apply_loaded_state ( )
inlineprivate

Definition at line 407 of file Column.h.

References SWC::Core::AtomicBase< T, OrderT >::compare_exchange_weak(), SWC::DB::Types::MngrColumn::LOADING, m_check_ts, m_state, SWC::Time::now_ms(), and SWC::Error::OK.

Referenced by remove_range(), and sort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assigned() [1/2]

void SWC::Manager::Column::assigned ( Core::Vector< rgrid_t > &  rgrids)
inline

Definition at line 273 of file Column.h.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), m_mutex, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

+ Here is the call graph for this function:

◆ assigned() [2/2]

void SWC::Manager::Column::assigned ( rgrid_t  rgrid,
size_t &  num,
Core::Vector< Range::Ptr > &  _ranges 
)
inline

Definition at line 104 of file Column.h.

References m_mutex, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

+ Here is the call graph for this function:

◆ change_rgr()

void SWC::Manager::Column::change_rgr ( rgrid_t  rgrid_old,
rgrid_t  rgrid 
)
inline

Definition at line 229 of file Column.h.

References m_mutex, and m_schemas_rev.

◆ change_rgr_schema()

void SWC::Manager::Column::change_rgr_schema ( const rgrid_t  rgrid,
int64_t  rev = 0 
)
inline

Definition at line 245 of file Column.h.

References m_mutex, and m_schemas_rev.

◆ create()

static bool SWC::Manager::Column::create ( int &  err,
const cid_t  cid 
)
inlinestatic

Definition at line 26 of file Column.h.

References SWC::DB::RangeBase::get_path(), and SWC::Env::FsInterface::interface().

Referenced by SWC::Manager::MngdColumns::create(), init(), and SWC::Manager::MngdColumns::initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_new_range()

Range::Ptr SWC::Manager::Column::create_new_range ( rgrid_t  rgrid)
inline

Definition at line 191 of file Column.h.

References _get_next_rid(), cfg, SWC::DB::Types::MngrRange::CREATED, SWC::Core::Vector< Range::Ptr >::emplace_back(), and m_mutex.

+ Here is the call graph for this function:

◆ do_remove()

bool SWC::Manager::Column::do_remove ( )
inline

Definition at line 324 of file Column.h.

References SWC::DB::Types::MngrColumn::DELETED, SWC::Core::AtomicBase< T, OrderT >::exchange(), m_mutex, m_schemas_rev, and m_state.

+ Here is the call graph for this function:

◆ finalize_remove()

bool SWC::Manager::Column::finalize_remove ( int &  err,
rgrid_t  rgrid = 0 
)
inline

◆ get_next_rid()

rid_t SWC::Manager::Column::get_next_rid ( )
inline

Definition at line 200 of file Column.h.

References _get_next_rid(), and m_mutex.

+ Here is the call graph for this function:

◆ get_next_unassigned()

Range::Ptr SWC::Manager::Column::get_next_unassigned ( )
inline

Definition at line 205 of file Column.h.

References _set_loading(), and m_mutex.

+ Here is the call graph for this function:

◆ get_range() [1/2]

Range::Ptr SWC::Manager::Column::get_range ( const rid_t  rid)
inline

Definition at line 121 of file Column.h.

References m_mutex.

◆ get_range() [2/2]

Range::Ptr SWC::Manager::Column::get_range ( int &  ,
const DB::Cell::Key range_begin,
const DB::Cell::Key range_end,
bool  next_range 
)
inline

Definition at line 130 of file Column.h.

References m_mutex.

◆ get_ranges()

void SWC::Manager::Column::get_ranges ( Core::Vector< Range::Ptr > &  _ranges)
inline

Definition at line 116 of file Column.h.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::assign(), SWC::Core::Vector< Range::Ptr >::cbegin(), SWC::Core::Vector< Range::Ptr >::cend(), and m_mutex.

+ Here is the call graph for this function:

◆ init()

void SWC::Manager::Column::init ( int &  err)

◆ left_sibling()

Range::Ptr SWC::Manager::Column::left_sibling ( const Range::Ptr right)
inline

Definition at line 181 of file Column.h.

References SWC::Core::Vector< Range::Ptr >::cbegin(), SWC::Core::Vector< Range::Ptr >::cend(), SWC::Core::Vector< Range::Ptr >::empty(), and m_mutex.

+ Here is the call graph for this function:

◆ need_health_check() [1/2]

bool SWC::Manager::Column::need_health_check ( int64_t  ts,
uint32_t  ms 
)
inline

Definition at line 290 of file Column.h.

References m_check_ts, m_mutex, m_state, and SWC::Error::OK.

◆ need_health_check() [2/2]

void SWC::Manager::Column::need_health_check ( int64_t  ts,
uint32_t  ms,
Core::Vector< Range::Ptr > &  _ranges,
rgrid_t  rgrid = 0,
size_t  max = 0 
)
inline

Definition at line 299 of file Column.h.

References m_mutex, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), and SWC::Core::Vector< T, SizeT, GROW_SZ >::size().

+ Here is the call graph for this function:

◆ need_schema_sync() [1/2]

bool SWC::Manager::Column::need_schema_sync ( const rgrid_t  rgrid,
int64_t  rev 
)
inline

Definition at line 264 of file Column.h.

References m_mutex, and m_schemas_rev.

◆ need_schema_sync() [2/2]

void SWC::Manager::Column::need_schema_sync ( int64_t  rev,
Core::Vector< rgrid_t > &  rgrids 
)
inline

Definition at line 255 of file Column.h.

References m_mutex, m_schemas_rev, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

+ Here is the call graph for this function:

◆ print()

void SWC::Manager::Column::print ( std::ostream &  out)
inline

Definition at line 360 of file Column.h.

References _print(), and m_mutex.

+ Here is the call graph for this function:

◆ ranges()

size_t SWC::Manager::Column::ranges ( )
inline

Definition at line 99 of file Column.h.

References m_mutex, and SWC::Core::Vector< Range::Ptr >::size().

+ Here is the call graph for this function:

◆ remove()

static bool SWC::Manager::Column::remove ( int &  err,
const cid_t  cid 
)
inlinestatic

Definition at line 31 of file Column.h.

References SWC::DB::RangeBase::get_column_path(), and SWC::Env::FsInterface::interface().

Referenced by SWC::Manager::MngdColumns::create(), and SWC::Manager::MngdColumns::update_status_ack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_range()

void SWC::Manager::Column::remove_range ( rid_t  rid)
inline

Definition at line 312 of file Column.h.

References apply_loaded_state(), SWC::Core::Vector< Range::Ptr >::cbegin(), SWC::Core::Vector< Range::Ptr >::cend(), SWC::Core::Vector< Range::Ptr >::erase(), and m_mutex.

+ Here is the call graph for this function:

◆ remove_rgr_schema()

void SWC::Manager::Column::remove_rgr_schema ( const rgrid_t  rgrid)
inline

Definition at line 250 of file Column.h.

References _remove_rgr_schema(), and m_mutex.

+ Here is the call graph for this function:

◆ reset_health_check()

void SWC::Manager::Column::reset_health_check ( )
inline

Definition at line 285 of file Column.h.

References m_check_ts, and m_mutex.

◆ set_loading()

void SWC::Manager::Column::set_loading ( )
inline

Definition at line 53 of file Column.h.

References _set_loading(), and m_mutex.

+ Here is the call graph for this function:

◆ set_merging()

bool SWC::Manager::Column::set_merging ( const Range::Ptr range)
inline

Definition at line 64 of file Column.h.

References SWC::DB::Types::MngrColumn::DELETED, SWC::DB::Types::MngrColumn::LOADING, m_mutex, m_state, SWC::DB::Types::MngrRange::MERGE, and SWC::Core::AtomicBase< T, OrderT >::store().

+ Here is the call graph for this function:

◆ set_rgr_unassigned()

void SWC::Manager::Column::set_rgr_unassigned ( rgrid_t  rgrid)
inline

Definition at line 217 of file Column.h.

References _remove_rgr_schema(), _set_loading(), and m_mutex.

+ Here is the call graph for this function:

◆ set_unloaded()

void SWC::Manager::Column::set_unloaded ( const Range::Ptr range)
inline

Definition at line 58 of file Column.h.

References _set_loading(), and m_mutex.

+ Here is the call graph for this function:

◆ sort()

void SWC::Manager::Column::sort ( Range::Ptr range,
const DB::Cells::Interval interval,
int64_t  revision 
)
inline

Definition at line 150 of file Column.h.

References apply_loaded_state(), SWC::Core::Vector< Range::Ptr >::cbegin(), SWC::Core::Vector< Range::Ptr >::cend(), SWC::Core::Vector< Range::Ptr >::erase(), SWC::Core::Vector< Range::Ptr >::insert(), m_mutex, SWC::Core::Vector< Range::Ptr >::push_back(), and SWC::Core::Vector< Range::Ptr >::size().

+ Here is the call graph for this function:

◆ state() [1/2]

SWC_CAN_INLINE State SWC::Manager::Column::state ( )
inline

Definition at line 74 of file Column.h.

References m_mutex, and m_state.

◆ state() [2/2]

SWC_CAN_INLINE void SWC::Manager::Column::state ( int &  err)
inline

Member Data Documentation

◆ cfg

const ColumnCfg::Ptr SWC::Manager::Column::cfg

Definition at line 40 of file Column.h.

Referenced by _print(), create_new_range(), finalize_remove(), and init().

◆ m_check_ts

int64_t SWC::Manager::Column::m_check_ts
private

Definition at line 427 of file Column.h.

Referenced by _set_loading(), apply_loaded_state(), need_health_check(), and reset_health_check().

◆ m_mutex

◆ m_schemas_rev

std::unordered_map<rgrid_t, int64_t> SWC::Manager::Column::m_schemas_rev
private

◆ m_state

Core::Atomic<State> SWC::Manager::Column::m_state
private

The documentation for this class was generated from the following files: