| 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 #include "components/leveldb/public/cpp/remote_iterator.h" | 5 #include "components/leveldb/public/cpp/remote_iterator.h" |
| 6 | 6 |
| 7 #include "components/leveldb/public/cpp/util.h" | 7 #include "components/leveldb/public/cpp/util.h" |
| 8 | 8 |
| 9 namespace leveldb { | 9 namespace leveldb { |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 database_->IteratorSeekToFirst(iterator_id_, &valid_, &status_, &key_, | 27 database_->IteratorSeekToFirst(iterator_id_, &valid_, &status_, &key_, |
| 28 &value_); | 28 &value_); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void RemoteIterator::SeekToLast() { | 31 void RemoteIterator::SeekToLast() { |
| 32 database_->IteratorSeekToLast(iterator_id_, &valid_, &status_, &key_, | 32 database_->IteratorSeekToLast(iterator_id_, &valid_, &status_, &key_, |
| 33 &value_); | 33 &value_); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void RemoteIterator::Seek(const Slice& target) { | 36 void RemoteIterator::Seek(const Slice& target) { |
| 37 database_->IteratorSeek(iterator_id_, GetArrayFor(target), &valid_, &status_, | 37 database_->IteratorSeek(iterator_id_, GetVectorFor(target), &valid_, &status_, |
| 38 &key_, &value_); | 38 &key_, &value_); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void RemoteIterator::Next() { | 41 void RemoteIterator::Next() { |
| 42 database_->IteratorNext(iterator_id_, &valid_, &status_, &key_, &value_); | 42 database_->IteratorNext(iterator_id_, &valid_, &status_, &key_, &value_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void RemoteIterator::Prev() { | 45 void RemoteIterator::Prev() { |
| 46 database_->IteratorPrev(iterator_id_, &valid_, &status_, &key_, &value_); | 46 database_->IteratorPrev(iterator_id_, &valid_, &status_, &key_, &value_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Slice RemoteIterator::key() const { | 49 Slice RemoteIterator::key() const { |
| 50 return GetSliceFor(key_); | 50 if (!key_) |
| 51 return leveldb::Slice(); |
| 52 return GetSliceFor(*key_); |
| 51 } | 53 } |
| 52 | 54 |
| 53 Slice RemoteIterator::value() const { | 55 Slice RemoteIterator::value() const { |
| 54 return GetSliceFor(value_); | 56 if (!value_) |
| 57 return leveldb::Slice(); |
| 58 return GetSliceFor(*value_); |
| 55 } | 59 } |
| 56 | 60 |
| 57 Status RemoteIterator::status() const { | 61 Status RemoteIterator::status() const { |
| 58 return DatabaseErrorToStatus(status_, GetSliceFor(key_), GetSliceFor(value_)); | 62 return DatabaseErrorToStatus(status_, key(), value()); |
| 59 } | 63 } |
| 60 | 64 |
| 61 } // namespace leveldb | 65 } // namespace leveldb |
| OLD | NEW |