| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ | 5 #ifndef COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ |
| 6 #define COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ | 6 #define COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ |
| 7 | 7 |
| 8 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | 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" | 9 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" |
| 11 | 10 |
| 12 namespace leveldb { | 11 namespace leveldb { |
| 13 | 12 |
| 14 // A wrapper around the raw iterator movement methods on the mojo leveldb | 13 // A wrapper around the raw iterator movement methods on the mojo leveldb |
| 15 // interface to allow drop in replacement to current leveldb usage. | 14 // interface to allow drop in replacement to current leveldb usage. |
| 16 // | 15 // |
| 17 // Note: Next(), Prev() and all the Seek*() calls cause mojo sync calls. | 16 // Note: Next(), Prev() and all the Seek*() calls cause mojo sync calls. |
| 18 class RemoteIterator : public Iterator { | 17 class RemoteIterator : public Iterator { |
| 19 public: | 18 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 30 Slice key() const override; | 29 Slice key() const override; |
| 31 Slice value() const override; | 30 Slice value() const override; |
| 32 Status status() const override; | 31 Status status() const override; |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 mojom::LevelDBDatabase* database_; | 34 mojom::LevelDBDatabase* database_; |
| 36 uint64_t iterator_id_; | 35 uint64_t iterator_id_; |
| 37 | 36 |
| 38 bool valid_; | 37 bool valid_; |
| 39 mojom::DatabaseError status_; | 38 mojom::DatabaseError status_; |
| 40 mojo::Array<uint8_t> key_; | 39 base::Optional<std::vector<uint8_t>> key_; |
| 41 mojo::Array<uint8_t> value_; | 40 base::Optional<std::vector<uint8_t>> value_; |
| 42 | 41 |
| 43 DISALLOW_COPY_AND_ASSIGN(RemoteIterator); | 42 DISALLOW_COPY_AND_ASSIGN(RemoteIterator); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace leveldb | 45 } // namespace leveldb |
| 47 | 46 |
| 48 #endif // COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ | 47 #endif // COMPONENTS_LEVELDB_PUBLIC_CPP_REMOTE_ITERATOR_H_ |
| OLD | NEW |