|
|
|
@ -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; |
|
|
|
@ -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 TBlockIter, typename TValue = Slice> |
|
|
|
|
class BlockBasedTableIterator : public InternalIteratorBase<TValue> { |
|
|
|
|
public: |
|
|
|
|