2013-10-16 21:59:46 +00:00
|
|
|
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
//
|
2011-03-18 22:37:00 +00:00
|
|
|
// 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.
|
|
|
|
|
2013-10-05 05:32:05 +00:00
|
|
|
#pragma once
|
2013-08-23 15:38:13 +00:00
|
|
|
#include "rocksdb/iterator.h"
|
|
|
|
#include "rocksdb/env.h"
|
2014-04-25 19:22:23 +00:00
|
|
|
#include "table/iterator_wrapper.h"
|
2011-03-18 22:37:00 +00:00
|
|
|
|
2013-10-04 04:49:15 +00:00
|
|
|
namespace rocksdb {
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
struct ReadOptions;
|
2014-01-27 21:53:22 +00:00
|
|
|
class InternalKeyComparator;
|
2011-03-18 22:37:00 +00:00
|
|
|
|
2014-04-25 19:22:23 +00:00
|
|
|
struct TwoLevelIteratorState {
|
2014-04-25 19:23:07 +00:00
|
|
|
explicit TwoLevelIteratorState(bool check_prefix_may_match)
|
|
|
|
: check_prefix_may_match(check_prefix_may_match) {}
|
2014-04-25 19:22:23 +00:00
|
|
|
|
|
|
|
virtual ~TwoLevelIteratorState() {}
|
|
|
|
virtual Iterator* NewSecondaryIterator(const Slice& handle) = 0;
|
|
|
|
virtual bool PrefixMayMatch(const Slice& internal_key) = 0;
|
|
|
|
|
2014-04-25 19:23:07 +00:00
|
|
|
// If call PrefixMayMatch()
|
|
|
|
bool check_prefix_may_match;
|
2014-04-25 19:22:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-18 22:37:00 +00:00
|
|
|
// 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.
|
2014-04-25 19:22:23 +00:00
|
|
|
extern Iterator* NewTwoLevelIterator(TwoLevelIteratorState* state,
|
|
|
|
Iterator* first_level_iter);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
2013-10-04 04:49:15 +00:00
|
|
|
} // namespace rocksdb
|