Add Google's LevelDB support
[novacoin.git] / src / leveldb / table / two_level_iterator.h
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 extern Iterator* NewTwoLevelIterator(
24     Iterator* index_iter,
25     Iterator* (*block_function)(
26         void* arg,
27         const ReadOptions& options,
28         const Slice& index_value),
29     void* arg,
30     const ReadOptions& options);
31
32 }  // namespace leveldb
33
34 #endif  // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_