two_level_iterator.h 1.2 KB

12345678910111213141516171819202122232425262728293031
  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. #ifndef STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
  5. #define STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_
  6. #include "leveldb/iterator.h"
  7. namespace leveldb {
  8. struct ReadOptions;
  9. // Return a new two level iterator. A two-level iterator contains an
  10. // index iterator whose values point to a sequence of blocks where
  11. // each block is itself a sequence of key,value pairs. The returned
  12. // two-level iterator yields the concatenation of all key/value pairs
  13. // in the sequence of blocks. Takes ownership of "index_iter" and
  14. // will delete it when no longer needed.
  15. //
  16. // Uses a supplied function to convert an index_iter value into
  17. // an iterator over the contents of the corresponding block.
  18. Iterator* NewTwoLevelIterator(
  19. Iterator* index_iter,
  20. Iterator* (*block_function)(void* arg, const ReadOptions& options,
  21. const Slice& index_value),
  22. void* arg, const ReadOptions& options);
  23. } // namespace leveldb
  24. #endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_