Comments for BlockBasedTable

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/5352

Differential Revision: D15498477

Pulled By: vjnadimpalli

fbshipit-source-id: 08a981521848433362a56ac521c7fb83c7dd7b2a
This commit is contained in:
Vijay Nadimpalli 2019-05-24 12:26:58 -07:00 committed by Facebook Github Bot
parent f69e63dc5f
commit f66026c8c7
2 changed files with 20 additions and 7 deletions

View File

@ -59,9 +59,17 @@ class GetContext;
typedef std::vector<std::pair<std::string, std::string>> KVPairBlock; typedef std::vector<std::pair<std::string, std::string>> KVPairBlock;
// A Table is a sorted map from strings to strings. Tables are // Reader class for BlockBasedTable format.
// immutable and persistent. A Table may be safely accessed from // For the format of BlockBasedTable refer to
// multiple threads without external synchronization. // https://github.com/facebook/rocksdb/wiki/Rocksdb-BlockBasedTable-Format.
// This is the default table type. Data is chucked into fixed size blocks and
// each block in-turn stores entries. When storing data, we can compress and/or
// encode data efficiently within a block, which often results in a much smaller
// data size compared with the raw data size. As for the record retrieval, we'll
// first locate the block where target record may reside, then read the block to
// memory, and finally search that record within the block. Of course, to avoid
// frequent reads of the same block, we introduced the block cache to keep the
// loaded blocks in the memory.
class BlockBasedTable : public TableReader { class BlockBasedTable : public TableReader {
public: public:
static const std::string kFilterBlockPrefix; static const std::string kFilterBlockPrefix;
@ -425,7 +433,7 @@ class BlockBasedTable : public TableReader {
friend class PartitionedFilterBlockTest; friend class PartitionedFilterBlockTest;
}; };
// Maitaning state of a two-level iteration on a partitioned index structure // Maitaning state of a two-level iteration on a partitioned index structure.
class BlockBasedTable::PartitionedIndexIteratorState class BlockBasedTable::PartitionedIndexIteratorState
: public TwoLevelIteratorState { : public TwoLevelIteratorState {
public: public:
@ -444,6 +452,8 @@ class BlockBasedTable::PartitionedIndexIteratorState
bool index_key_is_full_; bool index_key_is_full_;
}; };
// Stores all the properties associated with a BlockBasedTable.
// These are immutable.
struct BlockBasedTable::Rep { struct BlockBasedTable::Rep {
Rep(const ImmutableCFOptions& _ioptions, const EnvOptions& _env_options, Rep(const ImmutableCFOptions& _ioptions, const EnvOptions& _env_options,
const BlockBasedTableOptions& _table_opt, const BlockBasedTableOptions& _table_opt,
@ -553,6 +563,7 @@ struct BlockBasedTable::Rep {
} }
}; };
// Iterates over the contents of BlockBasedTable.
template <class TBlockIter, typename TValue = Slice> template <class TBlockIter, typename TValue = Slice>
class BlockBasedTableIterator : public InternalIteratorBase<TValue> { class BlockBasedTableIterator : public InternalIteratorBase<TValue> {
public: public:

View File

@ -26,9 +26,11 @@ struct TableProperties;
class GetContext; class GetContext;
class MultiGetContext; class MultiGetContext;
// A Table is a sorted map from strings to strings. Tables are // A Table (also referred to as SST) is a sorted map from strings to strings.
// immutable and persistent. A Table may be safely accessed from // Tables are immutable and persistent. A Table may be safely accessed from
// multiple threads without external synchronization. // multiple threads without external synchronization. Table readers are used
// for reading various types of table formats supported by rocksdb including
// BlockBasedTable, PlainTable and CuckooTable format.
class TableReader { class TableReader {
public: public:
virtual ~TableReader() {} virtual ~TableReader() {}