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

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

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
« no previous file with comments | « components/leveldb/public/cpp/remote_iterator.h ('k') | components/leveldb/public/cpp/util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/leveldb/public/cpp/remote_iterator.h"
6
7 #include "components/leveldb/public/cpp/util.h"
8
9 namespace leveldb {
10
11 RemoteIterator::RemoteIterator(LevelDBDatabase* database, uint64_t iterator_id)
12 : database_(database),
13 iterator_id_(iterator_id),
14 valid_(false),
15 status_(DatabaseError::OK) {}
16
17 RemoteIterator::~RemoteIterator() {
18 database_->ReleaseIterator(iterator_id_);
19 }
20
21 bool RemoteIterator::Valid() const {
22 return valid_;
23 }
24
25 void RemoteIterator::SeekToFirst() {
26 database_->IteratorSeekToFirst(iterator_id_, &valid_, &status_, &key_,
27 &value_);
28 }
29
30 void RemoteIterator::SeekToLast() {
31 database_->IteratorSeekToLast(iterator_id_, &valid_, &status_, &key_,
32 &value_);
33 }
34
35 void RemoteIterator::Seek(const Slice& target) {
36 database_->IteratorSeek(iterator_id_, GetArrayFor(target), &valid_, &status_,
37 &key_, &value_);
38 }
39
40 void RemoteIterator::Next() {
41 database_->IteratorNext(iterator_id_, &valid_, &status_, &key_, &value_);
42 }
43
44 void RemoteIterator::Prev() {
45 database_->IteratorPrev(iterator_id_, &valid_, &status_, &key_, &value_);
46 }
47
48 Slice RemoteIterator::key() const {
49 return GetSliceFor(key_);
50 }
51
52 Slice RemoteIterator::value() const {
53 return GetSliceFor(value_);
54 }
55
56 Status RemoteIterator::status() const {
57 return DatabaseErrorToStatus(status_, GetSliceFor(key_), GetSliceFor(value_));
58 }
59
60 } // namespace leveldb
OLDNEW
« no previous file with comments | « components/leveldb/public/cpp/remote_iterator.h ('k') | components/leveldb/public/cpp/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698