#include <swcdb/ranger/db/CellStore.h>
Public Types | |
typedef Read * | Ptr |
typedef Core::Vector< Block::Read::Ptr > | Blocks |
Public Member Functions | |
Read (const csid_t csid, DB::Cell::Key &&prev_key_end, DB::Cell::Key &&key_end, DB::Cells::Interval &&interval, Blocks &&blocks, const uint32_t cell_revs, const FS::SmartFd::Ptr &smartfd) noexcept | |
Read (const Read &)=delete | |
Read (const Read &&)=delete | |
Read & | operator= (const Read &)=delete |
~Read () noexcept | |
const std::string & | filepath () const |
void | load_cells (BlockLoader *loader) |
void | _run_queued () |
void | get_blocks (int &err, Blocks &to) const |
size_t | release (size_t bytes) |
void | close (int &err) |
void | remove (int &err) |
bool | processing () const noexcept |
size_t | size_bytes (bool only_loaded=false) const |
size_t | size_bytes_enc (bool only_loaded=false) const |
size_t | blocks_count () const |
void | print (std::ostream &out, bool minimal=true) const |
Static Public Member Functions | |
static Ptr | make (int &err, const csid_t csid, const RangePtr &range, bool chk_base=false) |
static bool | load_trailer (int &err, FS::SmartFd::Ptr &smartfd, uint32_t &cell_revs, uint32_t &blks_idx_count, uint64_t &blks_idx_offset, bool close_after=false, bool chk_base=false) |
static void | load_blocks_index (int &err, FS::SmartFd::Ptr &smartfd, DB::Cell::Key &prev_key_end, DB::Cell::Key &key_end, DB::Cells::Interval &interval, Blocks &blocks, uint32_t &cell_revs, bool chk_base=false) |
Public Attributes | |
const csid_t | csid |
const DB::Cell::Key | prev_key_end |
const DB::Cell::Key | key_end |
const DB::Cells::Interval | interval |
const Blocks | blocks |
const uint32_t | cell_revs |
FS::SmartFd::Ptr | smartfd |
Static Public Attributes | |
static constexpr uint32_t | MAX_BLOCKS = UINT32_MAX |
Private Member Functions | |
void | _release_fd () |
Private Attributes | |
Core::QueueSafeStated< Block::Read::Ptr > | m_queue |
Definition at line 41 of file CellStore.h.
Definition at line 45 of file CellStore.h.
typedef Read* SWC::Ranger::CellStore::Read::Ptr |
Definition at line 44 of file CellStore.h.
|
explicitnoexcept |
Definition at line 255 of file CellStore.cc.
Referenced by make().
|
delete |
|
delete |
|
noexcept |
Definition at line 274 of file CellStore.cc.
References blocks.
|
private |
Definition at line 335 of file CellStore.cc.
References close(), SWC::Env::FsInterface::interface(), SWC::Error::OK, processing(), and smartfd.
Referenced by _run_queued(), and release().
SWC_CAN_INLINE void SWC::Ranger::CellStore::Read::_run_queued | ( | ) |
Definition at line 311 of file CellStore.cc.
References _release_fd(), SWC::Ranger::CellStore::Block::Read::load(), and m_queue.
Referenced by SWC::Ranger::CellStore::Block::Read::load_finish().
SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Read::blocks_count | ( | ) | const |
Definition at line 386 of file CellStore.cc.
References blocks, and SWC::Core::Vector< T, SizeT, GROW_SZ >::size().
Referenced by print().
SWC_CAN_INLINE void SWC::Ranger::CellStore::Read::close | ( | int & | err | ) |
Definition at line 345 of file CellStore.cc.
References SWC::Env::FsInterface::interface(), SWC::FS::SmartFd::make_ptr(), and smartfd.
Referenced by _release_fd().
SWC_CAN_INLINE const std::string & SWC::Ranger::CellStore::Read::filepath | ( | ) | const |
Definition at line 291 of file CellStore.cc.
References smartfd.
SWC_CAN_INLINE void SWC::Ranger::CellStore::Read::get_blocks | ( | int & | err, |
Blocks & | to | ||
) | const |
Definition at line 317 of file CellStore.cc.
References blocks, SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), and SWC::Core::Vector< T, SizeT, GROW_SZ >::insert().
|
static |
Definition at line 118 of file CellStore.cc.
References SWC::DB::Cells::Interval::align(), SWC::Ranger::CellStore::Block::Header::ANY_BEGIN, SWC::Ranger::CellStore::Block::Header::ANY_END, SWC::Core::Buffer< T >::base, blocks, cell_revs, SWC::Core::checksum_i32_chk(), SWC::Error::CHECKSUM_MISMATCH, SWC::Core::Vector< T, SizeT, GROW_SZ >::clear(), SWC::DB::Cell::Key::copy(), SWC::DB::Cell::Key::decode(), SWC::Core::Encoder::decode(), SWC::Serialization::decode_i32(), SWC::Serialization::decode_i8(), SWC::Ranger::CellStore::Block::Header::decode_idx(), SWC::Serialization::decode_vi32(), SWC::DB::Cells::Interval::expand(), SWC::Core::Buffer< T >::free(), SWC::DB::Cell::Key::free(), SWC::Env::FsInterface::fs(), SWC::Error::FS_EOF, SWC::Ranger::CellStore::IDX_BLKS_HEADER_SIZE, SWC::Env::FsInterface::interface(), interval, SWC::Ranger::CellStore::Block::Header::interval, SWC::Ranger::CellStore::Block::Header::is_any, SWC::DB::Cells::Interval::key_begin, SWC::DB::Cells::Interval::key_end, key_end, SWC::DB::Cells::Interval::key_seq, load_trailer(), SWC::LOG_WARN, SWC::Error::OK, prev_key_end, SWC::Error::print(), SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), SWC::Core::Vector< T, SizeT, GROW_SZ >::reserve(), SWC::Core::Buffer< T >::set(), SWC::Core::Vector< T, SizeT, GROW_SZ >::size(), smartfd, SWC_LOG_OSTREAM, and SWC_LOG_OUT.
Referenced by make().
SWC_CAN_INLINE void SWC::Ranger::CellStore::Read::load_cells | ( | BlockLoader * | loader | ) |
Definition at line 296 of file CellStore.cc.
References SWC::Ranger::BlockLoader::add(), SWC::Ranger::BlockLoader::block, blocks, SWC::Ranger::Block::is_consist(), SWC::Ranger::Block::is_in_end(), and m_queue.
|
static |
Definition at line 51 of file CellStore.cc.
References cell_revs, SWC::Core::checksum_i32_chk(), SWC::Error::CHECKSUM_MISMATCH, SWC::Serialization::decode_i32(), SWC::Serialization::decode_i64(), SWC::Serialization::decode_i8(), SWC::Env::FsInterface::fs(), SWC::Error::FS_EOF, SWC::Error::FS_PATH_NOT_FOUND, SWC::Env::FsInterface::interface(), SWC::Comm::Protocol::FsBroker::Handler::length(), SWC::LOG_WARN, SWC::Error::OK, SWC::Error::print(), smartfd, SWC_LOG_OSTREAM, SWC_LOG_OUT, and SWC::Ranger::CellStore::TRAILER_SIZE.
Referenced by load_blocks_index().
|
inlinestatic |
Definition at line 13 of file CellStore.cc.
References blocks, cell_revs, SWC::Error::Exception::code(), csid, interval, key_end, load_blocks_index(), SWC::LOG_ERROR, SWC::FS::SmartFd::make_ptr(), prev_key_end, SWC::DB::Cells::Interval::print(), SWC::Error::print(), Read(), SWC::Core::Vector< T, SizeT, GROW_SZ >::shrink_to_fit(), smartfd, SWC_CURRENT_EXCEPTION, SWC_LOG_OSTREAM, and SWC_LOG_OUT.
Referenced by SWC::Ranger::CellStore::create_initial(), SWC::Ranger::CellStore::Readers::decode(), SWC::Ranger::Range::internal_create(), SWC::Ranger::CellStore::Readers::load_from_path(), SWC::Ranger::CellStore::Readers::move_from(), and SWC::Ranger::CellStore::Readers::replace().
void SWC::Ranger::CellStore::Read::print | ( | std::ostream & | out, |
bool | minimal = true |
||
) | const |
Definition at line 390 of file CellStore.cc.
References blocks, blocks_count(), csid, interval, key_end, m_queue, prev_key_end, processing(), size_bytes(), smartfd, and SWC::Ranger::CellStore::VERSION.
|
noexcept |
Definition at line 359 of file CellStore.cc.
References blocks, and m_queue.
Referenced by _release_fd(), and print().
SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Read::release | ( | size_t | bytes | ) |
Definition at line 322 of file CellStore.cc.
References _release_fd(), blocks, and m_queue.
SWC_CAN_INLINE void SWC::Ranger::CellStore::Read::remove | ( | int & | err | ) |
Definition at line 354 of file CellStore.cc.
References SWC::Env::FsInterface::interface(), and smartfd.
SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Read::size_bytes | ( | bool | only_loaded = false | ) | const |
Definition at line 370 of file CellStore.cc.
Referenced by print().
SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Read::size_bytes_enc | ( | bool | only_loaded = false | ) | const |
Definition at line 378 of file CellStore.cc.
const Blocks SWC::Ranger::CellStore::Read::blocks |
Definition at line 72 of file CellStore.h.
Referenced by blocks_count(), get_blocks(), load_blocks_index(), load_cells(), make(), print(), processing(), release(), size_bytes(), size_bytes_enc(), and ~Read().
const uint32_t SWC::Ranger::CellStore::Read::cell_revs |
Definition at line 73 of file CellStore.h.
Referenced by load_blocks_index(), SWC::Ranger::CellStore::Block::Read::load_cells(), load_trailer(), and make().
const csid_t SWC::Ranger::CellStore::Read::csid |
Definition at line 68 of file CellStore.h.
const DB::Cells::Interval SWC::Ranger::CellStore::Read::interval |
Definition at line 71 of file CellStore.h.
Referenced by load_blocks_index(), make(), and print().
const DB::Cell::Key SWC::Ranger::CellStore::Read::key_end |
Definition at line 70 of file CellStore.h.
Referenced by load_blocks_index(), make(), and print().
|
mutableprivate |
Definition at line 122 of file CellStore.h.
Referenced by _run_queued(), load_cells(), print(), processing(), and release().
|
staticconstexpr |
Definition at line 47 of file CellStore.h.
Referenced by SWC::Ranger::CompactRange::write_cells().
const DB::Cell::Key SWC::Ranger::CellStore::Read::prev_key_end |
Definition at line 69 of file CellStore.h.
Referenced by load_blocks_index(), make(), and print().
FS::SmartFd::Ptr SWC::Ranger::CellStore::Read::smartfd |
Definition at line 74 of file CellStore.h.
Referenced by _release_fd(), close(), filepath(), load_blocks_index(), SWC::Ranger::CellStore::Block::Read::load_finish(), SWC::Ranger::CellStore::Block::Read::load_open(), load_trailer(), make(), print(), and remove().