ab8d2f6ab2
Summary: Current posix advice implementation ties up the access pattern hint with the creation of a file. It is not possible to apply different advice for different access (random get vs compaction read), without keeping two open files for the same table. This patch extended the RandomeAccessFile interface to accept new access hint at anytime. Particularly, we are able to set different access hint on the same table file based on when/how the file is used. Two options are added to set the access hint, after the file is first opened and after the file is being compacted. Test Plan: make check; db_stress; db_bench Reviewers: dhruba Reviewed By: dhruba CC: MarkCallaghan, leveldb Differential Revision: https://reviews.facebook.net/D10905
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
#ifndef STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
|
|
#define STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
|
|
|
|
#include "leveldb/iterator.h"
|
|
#include "leveldb/env.h"
|
|
|
|
namespace leveldb {
|
|
|
|
struct ReadOptions;
|
|
|
|
// Return a new two level iterator. A two-level iterator contains an
|
|
// index iterator whose values point to a sequence of blocks where
|
|
// each block is itself a sequence of key,value pairs. The returned
|
|
// two-level iterator yields the concatenation of all key/value pairs
|
|
// in the sequence of blocks. Takes ownership of "index_iter" and
|
|
// will delete it when no longer needed.
|
|
//
|
|
// Uses a supplied function to convert an index_iter value into
|
|
// an iterator over the contents of the corresponding block.
|
|
extern Iterator* NewTwoLevelIterator(
|
|
Iterator* index_iter,
|
|
Iterator* (*block_function)(
|
|
void* arg,
|
|
const ReadOptions& options,
|
|
const EnvOptions& soptions,
|
|
const Slice& index_value,
|
|
bool for_compaction),
|
|
void* arg,
|
|
const ReadOptions& options,
|
|
const EnvOptions& soptions,
|
|
bool for_compaction = false);
|
|
|
|
} // namespace leveldb
|
|
|
|
#endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
|