Skip to content

Commit

Permalink
Comments for BlockBasedTable
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebook#5352

Differential Revision: D15498477

Pulled By: vjnadimpalli

fbshipit-source-id: 08a981521848433362a56ac521c7fb83c7dd7b2a
  • Loading branch information
vjnadimpalli authored and facebook-github-bot committed May 24, 2019
1 parent f69e63d commit f66026c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
19 changes: 15 additions & 4 deletions table/block_based_table_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ class GetContext;

typedef std::vector<std::pair<std::string, std::string>> 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;
Expand Down Expand Up @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -553,6 +563,7 @@ struct BlockBasedTable::Rep {
}
};

// Iterates over the contents of BlockBasedTable.
template <class TBlockIter, typename TValue = Slice>
class BlockBasedTableIterator : public InternalIteratorBase<TValue> {
public:
Expand Down
8 changes: 5 additions & 3 deletions table/table_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down

0 comments on commit f66026c

Please sign in to comment.