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 compression_dict Data for presetting the compression library's dictionary.
| 71 | // @param compression_dict Data for presetting the compression library's |
| 72 | // dictionary. |
| 73 | Status ReadBlockFromFile( |
| 74 | RandomAccessFileReader* file, FilePrefetchBuffer* prefetch_buffer, |
| 75 | const Footer& footer, const ReadOptions& options, const BlockHandle& handle, |
| 76 | std::unique_ptr<Block>* result, const ImmutableCFOptions& ioptions, |
| 77 | bool do_uncompress, bool maybe_compressed, const Slice& compression_dict, |
| 78 | const PersistentCacheOptions& cache_options, SequenceNumber global_seqno, |
| 79 | size_t read_amp_bytes_per_bit, MemoryAllocator* memory_allocator) { |
| 80 | BlockContents contents; |
| 81 | BlockFetcher block_fetcher(file, prefetch_buffer, footer, options, handle, |
| 82 | &contents, ioptions, do_uncompress, |
| 83 | maybe_compressed, compression_dict, cache_options, |
| 84 | memory_allocator); |
| 85 | Status s = block_fetcher.ReadBlockContents(); |
| 86 | if (s.ok()) { |
| 87 | result->reset(new Block(std::move(contents), global_seqno, |
| 88 | read_amp_bytes_per_bit, ioptions.statistics)); |
| 89 | } |
| 90 | |
| 91 | return s; |
| 92 | } |
| 93 | |
| 94 | inline MemoryAllocator* GetMemoryAllocator( |
| 95 | const BlockBasedTableOptions& table_options) { |
no test coverage detected