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::Common::Files::Schema Namespace Reference

Functions

std::string filepath (cid_t cid)
 
void remove (int &err, cid_t cid)
 
void write (SWC::DynamicBuffer &dst_buf, const DB::Schema::Ptr &schema)
 
void save (int &err, const DB::Schema::Ptr &schema, uint8_t replication=0)
 
void load (int &err, const std::string &filepath, DB::Schema::Ptr &schema)
 
DB::Schema::Ptr load (int &err, cid_t cid, uint8_t replication, bool recover=true)
 
void save_with_validation (int &err, const DB::Schema::Ptr &schema_save, uint8_t replication)
 

Variables

const uint8_t HEADER_SIZE = 13
 
const uint8_t HEADER_OFFSET_CHKSUM = 9
 
const uint8_t VERSION = 1
 
static const char schema_file [] = "schema.data"
 

Function Documentation

◆ filepath()

std::string SWC::Common::Files::Schema::filepath ( cid_t  cid)

Definition at line 34 of file Schema.h.

References SWC::DB::RangeBase::get_column_path(), and schema_file.

Referenced by SWC::Core::LogWriter::_renew_files(), SWC::Common::Files::RgrData::get_rgr(), load(), SWC::Comm::ConfigSSL::load_file(), SWC::Ranger::CommitLog::Fragment::make_read(), SWC::Ranger::CommitLog::Fragment::make_write(), SWC::client::SQL::parse_dump(), SWC::client::SQL::QuerySelect::parse_dump(), SWC::client::SQL::parse_load(), SWC::client::SQL::QueryUpdate::parse_load(), SWC::Common::Files::RgrData::read(), remove(), SWC::DB::Cells::TSV::FileWriter::roll_file(), save(), and SWC::Common::Files::RgrData::set_rgr().

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

◆ load() [1/2]

◆ load() [2/2]

void SWC::Common::Files::Schema::load ( int &  err,
const std::string &  filepath,
DB::Schema::Ptr schema 
)

Definition at line 87 of file Schema.h.

References SWC::Core::Buffer< T >::base, SWC::Core::checksum_i32_chk(), SWC::Error::CHECKSUM_MISMATCH, SWC::Serialization::decode_i32(), SWC::Serialization::decode_i8(), filepath(), HEADER_OFFSET_CHKSUM, HEADER_SIZE, SWC::Env::FsInterface::interface(), and SWC::Core::Buffer< T >::size.

Referenced by SWC::Manager::MngdColumns::initialize(), SWC::Core::AtomicBase< State >::load(), load(), and save_with_validation().

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

◆ remove()

void SWC::Common::Files::Schema::remove ( int &  err,
cid_t  cid 
)

Definition at line 44 of file Schema.h.

References filepath(), and SWC::Env::FsInterface::interface().

Referenced by SWC::FS::FileSystem::remove().

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

◆ save()

void SWC::Common::Files::Schema::save ( int &  err,
const DB::Schema::Ptr schema,
uint8_t  replication = 0 
)

Definition at line 70 of file Schema.h.

References filepath(), SWC::Env::FsInterface::interface(), SWC::FS::SmartFd::make_ptr(), SWC::FS::OPEN_FLAG_OVERWRITE, and write().

Referenced by SWC::Ranger::RangeData::load(), load(), and save_with_validation().

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

◆ save_with_validation()

void SWC::Common::Files::Schema::save_with_validation ( int &  err,
const DB::Schema::Ptr schema_save,
uint8_t  replication 
)

Definition at line 174 of file Schema.h.

References SWC::Error::COLUMN_SCHEMA_BAD_SAVE, load(), SWC::Error::OK, and save().

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

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

◆ write()

void SWC::Common::Files::Schema::write ( SWC::DynamicBuffer dst_buf,
const DB::Schema::Ptr schema 
)

Definition at line 50 of file Schema.h.

References SWC::Core::Buffer< T >::base, SWC::Core::checksum_i32(), SWC::Serialization::encode_i32(), SWC::Serialization::encode_i8(), SWC::Core::BufferDyn< BufferT >::ensure(), HEADER_SIZE, SWC::Core::BufferDyn< BufferT >::ptr, and VERSION.

Referenced by SWC::Ranger::CommitLog::Compact::Group::run(), SWC::Ranger::RangeData::save(), save(), and SWC::FS::FileSystem::write().

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

Variable Documentation

◆ HEADER_OFFSET_CHKSUM

const uint8_t SWC::Common::Files::Schema::HEADER_OFFSET_CHKSUM = 9

Definition at line 24 of file Schema.h.

Referenced by load().

◆ HEADER_SIZE

const uint8_t SWC::Common::Files::Schema::HEADER_SIZE = 13

Definition at line 23 of file Schema.h.

Referenced by load(), and write().

◆ schema_file

const char SWC::Common::Files::Schema::schema_file[] = "schema.data"
static

Definition at line 26 of file Schema.h.

Referenced by filepath().

◆ VERSION

const uint8_t SWC::Common::Files::Schema::VERSION = 1

Definition at line 25 of file Schema.h.

Referenced by SWC::Ranger::RangeData::write(), and write().