diff --git a/table/block_based_table_reader.h b/table/block_based_table_reader.h index 8274f0cf9..270409b3a 100644 --- a/table/block_based_table_reader.h +++ b/table/block_based_table_reader.h @@ -59,9 +59,17 @@ class GetContext; typedef std::vector> KVPairBlock; -// A Table is a sorted map from strings to strings. Tables are -// immutable and persistent. A Table may be safely accessed from -// multiple threads without external synchronization. +// Reader class for BlockBasedTable format. +// For the format of BlockBasedTable refer to +// 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 { public: static const std::string kFilterBlockPrefix; @@ -425,7 +433,7 @@ class BlockBasedTable : public TableReader { 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 : public TwoLevelIteratorState { public: @@ -444,6 +452,8 @@ class BlockBasedTable::PartitionedIndexIteratorState bool index_key_is_full_; }; +// Stores all the properties associated with a BlockBasedTable. +// These are immutable. struct BlockBasedTable::Rep { Rep(const ImmutableCFOptions& _ioptions, const EnvOptions& _env_options, const BlockBasedTableOptions& _table_opt, @@ -553,6 +563,7 @@ struct BlockBasedTable::Rep { } }; +// Iterates over the contents of BlockBasedTable. template class BlockBasedTableIterator : public InternalIteratorBase { public: diff --git a/table/table_reader.h b/table/table_reader.h index bd6071d9c..037dbc338 100644 --- a/table/table_reader.h +++ b/table/table_reader.h @@ -26,9 +26,11 @@ struct TableProperties; class GetContext; class MultiGetContext; -// A Table is a sorted map from strings to strings. Tables are -// immutable and persistent. A Table may be safely accessed from -// multiple threads without external synchronization. +// A Table (also referred to as SST) is a sorted map from strings to strings. +// Tables are immutable and persistent. A Table may be safely accessed from +// 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 { public: virtual ~TableReader() {}