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::MngdColumns Class Referencefinal

#include <swcdb/manager/MngdColumns.h>

+ Collaboration diagram for SWC::Manager::MngdColumns:

Classes

struct  ColumnReq
 

Public Member Functions

 MngdColumns ()
 
 MngdColumns (const MngdColumns &)=delete
 
 MngdColumns (MngdColumns &&)=delete
 
MngdColumnsoperator= (const MngdColumns &)=delete
 
MngdColumnsoperator= (MngdColumns &&)=delete
 
 ~MngdColumns () noexcept
 
SWC_CAN_INLINE bool running () const noexcept
 
void stop ()
 
void create_schemas_store ()
 
void reset (bool schemas_mngr)
 
bool is_schemas_mngr (int &err)
 
bool has_active () noexcept
 
bool is_active (cid_t cid) noexcept
 
bool active (cid_t &cid_begin, cid_t &cid_end) noexcept
 
bool expected_ready () noexcept
 
void columns_ready (int &err)
 
Column::Ptr get_column (int &err, cid_t cid)
 
void change_active (const cid_t cid_begin, const cid_t cid_end, bool has_cols)
 
void require_sync ()
 
void action (const ColumnReq::Ptr &req)
 
void set_expect (cid_t cid_begin, cid_t cid_end, uint64_t total, cids_t &&columns, bool initial)
 
void update_status (Comm::Protocol::Mngr::Params::ColumnMng::Function func, const DB::Schema::Ptr &schema, int err, uint64_t req_id, bool initial=false)
 
void update (Comm::Protocol::Mngr::Params::ColumnMng::Function func, const DB::Schema::Ptr &schema, int err, uint64_t req_id)
 
void remove (const DB::Schema::Ptr &schema, rgrid_t rgrid, uint64_t req_id)
 
void print (std::ostream &out)
 
bool initialize ()
 

Public Attributes

const Config::Property::Value_uint8_g::Ptr cfg_schema_replication
 
const Config::Property::Value_uint64_g::Ptr cfg_schemas_store_cap
 
const Config::Property::Value_int32_g::Ptr cfg_schemas_store_blksz
 
const Config::Property::Value_enum_g::Ptr cfg_schemas_store_encoder
 
const Config::Property::Value_int32_g::Ptr cfg_delay_cols_init
 

Private Member Functions

bool columns_load ()
 
cid_t get_next_cid ()
 
void create (int &err, DB::Schema::Ptr &schema)
 
void update (int &err, DB::Schema::Ptr &schema, const DB::Schema::Ptr &old)
 
void update_status_ack (Comm::Protocol::Mngr::Params::ColumnMng::Function func, const DB::Schema::Ptr &schema, int err, uint64_t req_id)
 
void run_actions ()
 

Private Attributes

Core::AtomicBool m_run
 
Core::StateRunning m_columns_load
 
Core::MutexSptd m_mutex_schemas
 
Core::AtomicBool m_schemas_set
 
Core::MutexSptd m_mutex_active
 
bool m_cid_active
 
cid_t m_cid_begin
 
cid_t m_cid_end
 
uint64_t m_expected_remain
 
Core::Atomic< cid_tm_last_used_cid
 
std::forward_list< cid_tm_expected_load
 
Core::MutexSptd m_mutex_actions
 
Core::QueueSafe< ColumnReq::Ptrm_actions
 
std::unordered_map< uint64_t, ColumnReq::Ptrm_actions_pending
 

Static Private Attributes

constexpr static uint64_t STATE_COLUMNS_NOT_INITIALIZED = UINT64_MAX
 

Detailed Description

Definition at line 15 of file MngdColumns.h.

Constructor & Destructor Documentation

◆ MngdColumns() [1/3]

SWC::Manager::MngdColumns::MngdColumns ( )

Definition at line 22 of file MngdColumns.cc.

◆ MngdColumns() [2/3]

SWC::Manager::MngdColumns::MngdColumns ( const MngdColumns )
delete

◆ MngdColumns() [3/3]

SWC::Manager::MngdColumns::MngdColumns ( MngdColumns &&  )
delete

◆ ~MngdColumns()

SWC::Manager::MngdColumns::~MngdColumns ( )
inlinenoexcept

Definition at line 44 of file MngdColumns.h.

Member Function Documentation

◆ action()

SWC_CAN_INLINE void SWC::Manager::MngdColumns::action ( const ColumnReq::Ptr req)

Definition at line 238 of file MngdColumns.cc.

References m_actions, SWC::Env::Mngr::post(), SWC::Core::QueueSafe< ItemT >::push_and_is_1st(), run_actions(), and SWC_CAN_INLINE.

Referenced by SWC::Comm::Protocol::Mngr::Handler::column_mng().

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

◆ active()

bool SWC::Manager::MngdColumns::active ( cid_t cid_begin,
cid_t cid_end 
)
noexcept

Definition at line 146 of file MngdColumns.cc.

Referenced by set_expect(), and SWC::Manager::Rangers::update_status().

+ Here is the caller graph for this function:

◆ change_active()

void SWC::Manager::MngdColumns::change_active ( const cid_t  cid_begin,
const cid_t  cid_end,
bool  has_cols 
)

Definition at line 193 of file MngdColumns.cc.

References cfg_delay_cols_init, SWC::Env::Mngr::columns(), SWC::Config::Property::Value_int32_g::get(), m_cid_active, m_cid_begin, m_cid_end, m_expected_remain, m_mutex_active, m_mutex_schemas, m_run, SWC::Env::Mngr::rangers(), SWC::DB::Schemas::reset(), SWC::Manager::Columns::reset(), SWC::Env::Mngr::role(), SWC::Manager::Rangers::schedule_check(), SWC::DB::Types::MngrRole::SCHEMAS, SWC::Env::Mngr::schemas(), and STATE_COLUMNS_NOT_INITIALIZED.

Referenced by SWC::Manager::MngrRole::apply_role_changes().

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

◆ columns_load()

◆ columns_ready()

void SWC::Manager::MngdColumns::columns_ready ( int &  err)

Definition at line 161 of file MngdColumns.cc.

References SWC::Env::Mngr::columns(), m_cid_active, m_expected_remain, m_mutex_active, SWC::Error::MNGR_NOT_INITIALIZED, and SWC::Manager::Columns::state().

Referenced by SWC::Comm::Protocol::Mngr::Handler::Report::operator()().

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

◆ create()

void SWC::Manager::MngdColumns::create ( int &  err,
DB::Schema::Ptr schema 
)
private

Definition at line 722 of file MngdColumns.cc.

References SWC::DB::Schemas::add(), cfg_schema_replication, SWC::Error::COLUMN_REACHED_ID_LIMIT, SWC::Manager::Column::create(), SWC::Config::Property::Value_uint8_g::get(), SWC::DB::Schemas::get(), get_next_cid(), SWC::Error::INVALID_ARGUMENT, SWC::DB::Types::is_counter(), m_last_used_cid, SWC::DB::Schema::make(), SWC::DB::SchemaPrimitives::NO_CID, SWC::Time::now_ns(), SWC::Manager::Column::remove(), SWC::Common::Files::Schema::save_with_validation(), SWC::Env::Mngr::schemas(), SWC::Core::AtomicBase< T, OrderT >::store(), and SWC::DB::Cell::Serial::Value::UNKNOWN.

Referenced by run_actions().

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

◆ create_schemas_store()

void SWC::Manager::MngdColumns::create_schemas_store ( )

Definition at line 80 of file MngdColumns.cc.

References cfg_schema_replication, cfg_schemas_store_blksz, cfg_schemas_store_cap, cfg_schemas_store_encoder, SWC::Config::Property::Value_uint8_g::get(), SWC::Config::Property::Value_int32_g::get(), SWC::Config::Property::Value_uint64_g::get(), SWC::Config::Property::Value_enum_g::get(), is_schemas_mngr(), SWC::LOG_INFO, SWC::Error::OK, SWC::Error::print(), SWC::Env::Mngr::schemas(), SWC::Error::SERVER_SHUTTING_DOWN, size, SWC::Manager::Schemas::store_create(), SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by SWC::Manager::MngrRole::stop().

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

◆ expected_ready()

SWC_CAN_INLINE bool SWC::Manager::MngdColumns::expected_ready ( )
noexcept

Definition at line 156 of file MngdColumns.cc.

References m_expected_remain, and m_mutex_active.

Referenced by get_column().

+ Here is the caller graph for this function:

◆ get_column()

Column::Ptr SWC::Manager::MngdColumns::get_column ( int &  err,
cid_t  cid 
)

Definition at line 174 of file MngdColumns.cc.

References SWC::Error::COLUMN_NOT_EXISTS, SWC::Env::Mngr::columns(), expected_ready(), is_active(), is_schemas_mngr(), SWC::Error::MNGR_NOT_ACTIVE, and SWC::Error::MNGR_NOT_INITIALIZED.

Referenced by SWC::Comm::Protocol::Mngr::Handler::column_compact(), SWC::Comm::Protocol::Mngr::Handler::RangeCreate::operator()(), SWC::Comm::Protocol::Mngr::Handler::RangeRemove::operator()(), SWC::Comm::Protocol::Mngr::Handler::Report::operator()(), SWC::Comm::Protocol::Mngr::Handler::range_unloaded(), SWC::Comm::Protocol::Mngr::Handler::rgr_get(), and update_status().

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

◆ get_next_cid()

cid_t SWC::Manager::MngdColumns::get_next_cid ( )
private

Definition at line 708 of file MngdColumns.cc.

References SWC::Core::Atomic< T, OrderT >::add_rslt(), m_last_used_cid, SWC::Env::Mngr::schemas(), SWC::Core::AtomicBase< T, OrderT >::store(), and SWC::DB::Types::SystemColumn::SYS_CID_END.

Referenced by create().

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

◆ has_active()

SWC_CAN_INLINE bool SWC::Manager::MngdColumns::has_active ( )
noexcept

Definition at line 133 of file MngdColumns.cc.

References m_cid_active, and m_mutex_active.

◆ initialize()

◆ is_active()

SWC_CAN_INLINE bool SWC::Manager::MngdColumns::is_active ( cid_t  cid)
noexcept

Definition at line 139 of file MngdColumns.cc.

Referenced by get_column(), SWC::Comm::Protocol::Mngr::Handler::MngrColumnGet::handle(), and update_status().

+ Here is the caller graph for this function:

◆ is_schemas_mngr()

SWC_CAN_INLINE bool SWC::Manager::MngdColumns::is_schemas_mngr ( int &  err)

Definition at line 116 of file MngdColumns.cc.

References m_mutex_schemas, m_run, m_schemas_set, SWC::Error::MNGR_NOT_INITIALIZED, SWC::Env::Mngr::role(), SWC::DB::Types::MngrRole::SCHEMAS, and SWC::Error::SERVER_SHUTTING_DOWN.

Referenced by columns_load(), create_schemas_store(), get_column(), and run_actions().

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

◆ operator=() [1/2]

MngdColumns& SWC::Manager::MngdColumns::operator= ( const MngdColumns )
delete

◆ operator=() [2/2]

MngdColumns& SWC::Manager::MngdColumns::operator= ( MngdColumns &&  )
delete

◆ print()

void SWC::Manager::MngdColumns::print ( std::ostream &  out)

Definition at line 500 of file MngdColumns.cc.

References SWC::Env::Mngr::columns(), and SWC::Manager::Columns::print().

+ Here is the call graph for this function:

◆ remove()

◆ require_sync()

void SWC::Manager::MngdColumns::require_sync ( )

Definition at line 229 of file MngdColumns.cc.

References columns_load(), SWC::DB::Schema::make(), SWC::Error::OK, SWC::Env::Mngr::rangers(), SWC::Manager::Rangers::sync(), and update().

Referenced by SWC::Manager::MngrRole::update_manager_addr().

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

◆ reset()

void SWC::Manager::MngdColumns::reset ( bool  schemas_mngr)

Definition at line 98 of file MngdColumns.cc.

References m_cid_active, m_mutex_active, m_mutex_schemas, m_schemas_set, SWC::DB::Schemas::reset(), SWC::Env::Mngr::schemas(), and SWC::Core::AtomicBase< T, OrderT >::store().

Referenced by SWC::Manager::MngrRole::apply_role_changes().

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

◆ run_actions()

◆ running()

SWC_CAN_INLINE bool SWC::Manager::MngdColumns::running ( ) const
inlinenoexcept

Definition at line 47 of file MngdColumns.h.

References m_run.

Referenced by SWC::Comm::Protocol::Mngr::Handler::MngrColumnGet::valid().

+ Here is the caller graph for this function:

◆ set_expect()

void SWC::Manager::MngdColumns::set_expect ( cid_t  cid_begin,
cid_t  cid_end,
uint64_t  total,
cids_t &&  columns,
bool  initial 
)

Definition at line 249 of file MngdColumns.cc.

References active(), SWC::Env::Mngr::columns(), SWC::LOG_DEBUG, m_cid_active, m_cid_begin, m_cid_end, m_expected_load, m_expected_remain, m_mutex_active, m_run, SWC::Error::OK, SWC::Manager::MngrRole::req_mngr_inchain(), SWC::Env::Mngr::role(), SWC::DB::Types::MngrRole::SCHEMAS, STATE_COLUMNS_NOT_INITIALIZED, SWC_FMT_LU, and SWC_LOGF.

Referenced by columns_load(), and SWC::Comm::Protocol::Mngr::Handler::ColumnUpdate::operator()().

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

◆ stop()

void SWC::Manager::MngdColumns::stop ( )

Definition at line 48 of file MngdColumns.cc.

References SWC::Core::QueueSafe< ItemT >::empty(), SWC::LOG_DEBUG, SWC::LOG_INFO, m_actions, m_actions_pending, m_columns_load, m_expected_load, m_expected_remain, m_mutex_actions, m_mutex_active, m_run, SWC::Core::QueueSafe< ItemT >::size(), STATE_COLUMNS_NOT_INITIALIZED, SWC::Core::AtomicBase< T, OrderT >::store(), SWC_FMT_LU, SWC_LOG, and SWC_LOGF.

Referenced by SWC::Manager::MngrRole::stop().

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

◆ update() [1/2]

SWC_CAN_INLINE void SWC::Manager::MngdColumns::update ( Comm::Protocol::Mngr::Params::ColumnMng::Function  func,
const DB::Schema::Ptr schema,
int  err,
uint64_t  req_id 
)

Definition at line 808 of file MngdColumns.cc.

References SWC::Manager::MngrRole::req_mngr_inchain(), and SWC::Env::Mngr::role().

Referenced by remove(), require_sync(), run_actions(), update_status(), and SWC::Comm::Protocol::Rgr::Req::ColumnUpdate::updated().

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

◆ update() [2/2]

◆ update_status()

◆ update_status_ack()

void SWC::Manager::MngdColumns::update_status_ack ( Comm::Protocol::Mngr::Params::ColumnMng::Function  func,
const DB::Schema::Ptr schema,
int  err,
uint64_t  req_id 
)
private

Definition at line 818 of file MngdColumns.cc.

References SWC::Error::COLUMN_SCHEMA_NAME_NOT_EXISTS, columns_load(), SWC::DB::Schemas::get(), SWC::LOG_DEBUG, SWC::LOG_WARN, m_actions_pending, m_last_used_cid, m_mutex_actions, m_mutex_schemas, m_run, m_schemas_set, SWC::Error::MNGR_NOT_ACTIVE, SWC::Error::OK, SWC::Error::print(), SWC::DB::Schemas::remove(), SWC::Manager::Column::remove(), SWC::Env::Mngr::schemas(), SWC::Error::SERVER_SHUTTING_DOWN, SWC::Core::AtomicBase< T, OrderT >::store(), SWC_LOG_OSTREAM, SWC_LOG_OUT, and update_status().

Referenced by update_status().

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

Member Data Documentation

◆ cfg_delay_cols_init

const Config::Property::Value_int32_g::Ptr SWC::Manager::MngdColumns::cfg_delay_cols_init

Definition at line 34 of file MngdColumns.h.

Referenced by change_active().

◆ cfg_schema_replication

const Config::Property::Value_uint8_g::Ptr SWC::Manager::MngdColumns::cfg_schema_replication

Definition at line 30 of file MngdColumns.h.

Referenced by create(), create_schemas_store(), initialize(), and update().

◆ cfg_schemas_store_blksz

const Config::Property::Value_int32_g::Ptr SWC::Manager::MngdColumns::cfg_schemas_store_blksz

Definition at line 32 of file MngdColumns.h.

Referenced by create_schemas_store().

◆ cfg_schemas_store_cap

const Config::Property::Value_uint64_g::Ptr SWC::Manager::MngdColumns::cfg_schemas_store_cap

Definition at line 31 of file MngdColumns.h.

Referenced by create_schemas_store().

◆ cfg_schemas_store_encoder

const Config::Property::Value_enum_g::Ptr SWC::Manager::MngdColumns::cfg_schemas_store_encoder

Definition at line 33 of file MngdColumns.h.

Referenced by create_schemas_store().

◆ m_actions

Core::QueueSafe<ColumnReq::Ptr> SWC::Manager::MngdColumns::m_actions
private

Definition at line 130 of file MngdColumns.h.

Referenced by action(), run_actions(), and stop().

◆ m_actions_pending

std::unordered_map<uint64_t, ColumnReq::Ptr> SWC::Manager::MngdColumns::m_actions_pending
private

Definition at line 131 of file MngdColumns.h.

Referenced by run_actions(), stop(), and update_status_ack().

◆ m_cid_active

bool SWC::Manager::MngdColumns::m_cid_active
private

Definition at line 122 of file MngdColumns.h.

Referenced by change_active(), columns_ready(), has_active(), reset(), and set_expect().

◆ m_cid_begin

cid_t SWC::Manager::MngdColumns::m_cid_begin
private

Definition at line 123 of file MngdColumns.h.

Referenced by change_active(), and set_expect().

◆ m_cid_end

cid_t SWC::Manager::MngdColumns::m_cid_end
private

Definition at line 124 of file MngdColumns.h.

Referenced by change_active(), and set_expect().

◆ m_columns_load

Core::StateRunning SWC::Manager::MngdColumns::m_columns_load
private

Definition at line 116 of file MngdColumns.h.

Referenced by columns_load(), and stop().

◆ m_expected_load

std::forward_list<cid_t> SWC::Manager::MngdColumns::m_expected_load
private

Definition at line 127 of file MngdColumns.h.

Referenced by set_expect(), stop(), and update_status().

◆ m_expected_remain

uint64_t SWC::Manager::MngdColumns::m_expected_remain
private

◆ m_last_used_cid

Core::Atomic<cid_t> SWC::Manager::MngdColumns::m_last_used_cid
private

Definition at line 126 of file MngdColumns.h.

Referenced by create(), get_next_cid(), and update_status_ack().

◆ m_mutex_actions

Core::MutexSptd SWC::Manager::MngdColumns::m_mutex_actions
private

Definition at line 129 of file MngdColumns.h.

Referenced by run_actions(), stop(), and update_status_ack().

◆ m_mutex_active

Core::MutexSptd SWC::Manager::MngdColumns::m_mutex_active
private

◆ m_mutex_schemas

Core::MutexSptd SWC::Manager::MngdColumns::m_mutex_schemas
private

◆ m_run

Core::AtomicBool SWC::Manager::MngdColumns::m_run
private

◆ m_schemas_set

Core::AtomicBool SWC::Manager::MngdColumns::m_schemas_set
private

Definition at line 119 of file MngdColumns.h.

Referenced by initialize(), is_schemas_mngr(), reset(), run_actions(), and update_status_ack().

◆ STATE_COLUMNS_NOT_INITIALIZED

constexpr static uint64_t SWC::Manager::MngdColumns::STATE_COLUMNS_NOT_INITIALIZED = UINT64_MAX
staticconstexprprivate

Definition at line 133 of file MngdColumns.h.

Referenced by change_active(), columns_load(), set_expect(), stop(), and update_status().


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