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