two_level_iterator.h raw

   1  // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style license that can be
   3  // found in the LICENSE file. See the AUTHORS file for names of contributors.
   4  
   5  #ifndef STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
   6  #define STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
   7  
   8  #include "leveldb/iterator.h"
   9  
  10  namespace leveldb {
  11  
  12  struct ReadOptions;
  13  
  14  // Return a new two level iterator.  A two-level iterator contains an
  15  // index iterator whose values point to a sequence of blocks where
  16  // each block is itself a sequence of key,value pairs.  The returned
  17  // two-level iterator yields the concatenation of all key/value pairs
  18  // in the sequence of blocks.  Takes ownership of "index_iter" and
  19  // will delete it when no longer needed.
  20  //
  21  // Uses a supplied function to convert an index_iter value into
  22  // an iterator over the contents of the corresponding block.
  23  Iterator* NewTwoLevelIterator(
  24      Iterator* index_iter,
  25      Iterator* (*block_function)(void* arg, const ReadOptions& options,
  26                                  const Slice& index_value),
  27      void* arg, const ReadOptions& options);
  28  
  29  }  // namespace leveldb
  30  
  31  #endif  // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
  32