Read index from the file and create an intance for `BinarySearchIndexReader`. On success, index_reader will be populated; otherwise it will remain unmodified.
| 393 | // On success, index_reader will be populated; otherwise it will remain |
| 394 | // unmodified. |
| 395 | static Status Create(RandomAccessFileReader* file, |
| 396 | FilePrefetchBuffer* prefetch_buffer, |
| 397 | const Footer& footer, const BlockHandle& index_handle, |
| 398 | const ImmutableCFOptions& ioptions, |
| 399 | const InternalKeyComparator* icomparator, |
| 400 | IndexReader** index_reader, |
| 401 | const PersistentCacheOptions& cache_options, |
| 402 | const bool index_key_includes_seq, |
| 403 | const bool index_value_is_full, |
| 404 | MemoryAllocator* memory_allocator) { |
| 405 | std::unique_ptr<Block> index_block; |
| 406 | auto s = ReadBlockFromFile( |
| 407 | file, prefetch_buffer, footer, ReadOptions(), index_handle, |
| 408 | &index_block, ioptions, true /* decompress */, |
| 409 | true /*maybe_compressed*/, Slice() /*compression dict*/, cache_options, |
| 410 | kDisableGlobalSequenceNumber, 0 /* read_amp_bytes_per_bit */, |
| 411 | memory_allocator); |
| 412 | |
| 413 | if (s.ok()) { |
| 414 | *index_reader = new BinarySearchIndexReader( |
| 415 | icomparator, std::move(index_block), ioptions.statistics, |
| 416 | index_key_includes_seq, index_value_is_full); |
| 417 | } |
| 418 | |
| 419 | return s; |
| 420 | } |
| 421 | |
| 422 | virtual InternalIteratorBase<BlockHandle>* NewIterator( |
| 423 | IndexBlockIter* iter = nullptr, bool /*dont_care*/ = true, |
nothing calls this directly
no test coverage detected