From 40aa520a51bbf5b8bae54861a7c9c433a1b40006 Mon Sep 17 00:00:00 2001 From: Levi Tamasi Date: Thu, 23 May 2019 14:19:12 -0700 Subject: [PATCH] Add class comment for BlockFetcher Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/5337 Differential Revision: D15482289 Pulled By: ltamasi fbshipit-source-id: 8639ca78c1b8dfcc337a742d4d81d5752f12545f --- table/block_fetcher.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) 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,