diff --git a/table/block_fetcher.h b/table/block_fetcher.h index b5fee9415..0dcdfc761 100644 --- a/table/block_fetcher.h +++ b/table/block_fetcher.h @@ -13,14 +13,28 @@ #include "util/memory_allocator.h" namespace rocksdb { + +// Retrieves a single block of a given file. Utilizes the prefetch buffer and/or +// persistent cache provided (if any) to try to avoid reading from the file +// directly. Note that both the prefetch buffer and the persistent cache are +// optional; also, note that the persistent cache may be configured to store either +// compressed or uncompressed blocks. +// +// If the retrieved block is compressed and the do_uncompress flag is set, +// BlockFetcher uncompresses the block (using the uncompression dictionary, +// if provided, to prime the compression algorithm), and returns the resulting +// uncompressed block data. Otherwise, it returns the original block. +// +// Two read options affect the behavior of BlockFetcher: if verify_checksums is +// true, the checksum of the (original) block is checked; if fill_cache is true, +// the block is added to the persistent cache if needed. +// +// Memory for uncompressed and compressed blocks is allocated as needed +// using memory_allocator and memory_allocator_compressed, respectively +// (if provided; otherwise, the default allocator is used). + class BlockFetcher { public: - // Read the block identified by "handle" from "file". - // The only relevant option is options.verify_checksums for now. - // On failure return non-OK. - // On success fill *result and return OK - caller owns *result - // @param uncompression_dict Data for presetting the compression library's - // dictionary. BlockFetcher(RandomAccessFileReader* file, FilePrefetchBuffer* prefetch_buffer, const Footer& footer, const ReadOptions& read_options, const BlockHandle& handle,