MCPcopy Create free account
hub / github.com/bytedance/terarkdb / ReadBlockFromFile

Function ReadBlockFromFile

table/block_based_table_reader.cc:73–92  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

71// @param compression_dict Data for presetting the compression library's
72// dictionary.
73Status 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
94inline MemoryAllocator* GetMemoryAllocator(
95 const BlockBasedTableOptions& table_options) {

Callers 5

CreateMethod · 0.85
CreateMethod · 0.85
CreateMethod · 0.85
ReadMetaBlockMethod · 0.85
NewDataBlockIteratorMethod · 0.85

Calls 3

ReadBlockContentsMethod · 0.80
okMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected