Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: components/leveldb/public/cpp/remote_iterator.h

Issue 1861903002: mojo leveldb: Add an iteration interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium 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.
4
5 #ifndef COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_
6 #define COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_
7
8 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
9 #include "mojo/public/cpp/bindings/array.h"
10 #include "third_party/leveldatabase/src/include/leveldb/iterator.h"
11
12 namespace leveldb {
13
14 class LevelDBDatabase;
15
16 // A wrapper around the raw iterator movement methods on the mojo leveldb
17 // interface to allow drop in replacement to current leveldb usage.
18 //
19 // Note: Next(), Prev() and all the Seek*() calls cause mojo sync calls.
20 class RemoteIterator : public Iterator {
21 public:
22 RemoteIterator(LevelDBDatabase* database, uint64_t iterator_id);
23 ~RemoteIterator() override;
24
25 // Overridden from leveldb::Iterator:
26 bool Valid() const override;
27 void SeekToFirst() override;
28 void SeekToLast() override;
29 void Seek(const Slice& target) override;
30 void Next() override;
31 void Prev() override;
32 Slice key() const override;
33 Slice value() const override;
34 Status status() const override;
35
36 private:
37 LevelDBDatabase* database_;
38 uint64_t iterator_id_;
39
40 bool valid_;
41 DatabaseError status_;
42 mojo::Array<uint8_t> key_;
43 mojo::Array<uint8_t> value_;
44
45 DISALLOW_COPY_AND_ASSIGN(RemoteIterator);
46 };
47
48 } // namespace leveldb
49
50 #endif // COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_
OLDNEW
« no previous file with comments | « components/leveldb/public/cpp/BUILD.gn ('k') | components/leveldb/public/cpp/remote_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698