fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.1 KiB
63 lines
2.1 KiB
9 years ago
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
||
11 years ago
|
// 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.
|
||
|
//
|
||
14 years ago
|
// 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.
|
||
|
|
||
11 years ago
|
#pragma once
|
||
14 years ago
|
|
||
11 years ago
|
#include "rocksdb/types.h"
|
||
|
|
||
11 years ago
|
namespace rocksdb {
|
||
14 years ago
|
|
||
|
class Comparator;
|
||
9 years ago
|
class InternalIterator;
|
||
11 years ago
|
class Env;
|
||
11 years ago
|
class Arena;
|
||
14 years ago
|
|
||
|
// Return an iterator that provided the union of the data in
|
||
|
// children[0,n-1]. Takes ownership of the child iterators and
|
||
|
// will delete them when the result iterator is deleted.
|
||
|
//
|
||
|
// The result does no duplicate suppression. I.e., if a particular
|
||
|
// key is present in K child iterators, it will be yielded K times.
|
||
|
//
|
||
|
// REQUIRES: n >= 0
|
||
8 years ago
|
extern InternalIterator* NewMergingIterator(const Comparator* comparator,
|
||
|
InternalIterator** children, int n,
|
||
8 years ago
|
Arena* arena = nullptr,
|
||
|
bool prefix_seek_mode = false);
|
||
11 years ago
|
|
||
|
class MergingIterator;
|
||
|
|
||
|
// A builder class to build a merging iterator by adding iterators one by one.
|
||
|
class MergeIteratorBuilder {
|
||
|
public:
|
||
|
// comparator: the comparator used in merging comparator
|
||
|
// arena: where the merging iterator needs to be allocated from.
|
||
8 years ago
|
explicit MergeIteratorBuilder(const Comparator* comparator, Arena* arena,
|
||
|
bool prefix_seek_mode = false);
|
||
11 years ago
|
~MergeIteratorBuilder() {}
|
||
|
|
||
|
// Add iter to the merging iterator.
|
||
9 years ago
|
void AddIterator(InternalIterator* iter);
|
||
11 years ago
|
|
||
|
// Get arena used to build the merging iterator. It is called one a child
|
||
|
// iterator needs to be allocated.
|
||
|
Arena* GetArena() { return arena; }
|
||
|
|
||
|
// Return the result merging iterator.
|
||
9 years ago
|
InternalIterator* Finish();
|
||
11 years ago
|
|
||
|
private:
|
||
|
MergingIterator* merge_iter;
|
||
9 years ago
|
InternalIterator* first_iter;
|
||
11 years ago
|
bool use_merging_iter;
|
||
|
Arena* arena;
|
||
|
};
|
||
14 years ago
|
|
||
11 years ago
|
} // namespace rocksdb
|