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

Side by Side Diff: components/leveldb/util.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/util.h ('k') | no next file » | 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/util.h"
6
7 #include "third_party/leveldatabase/src/include/leveldb/status.h"
8
9 namespace leveldb {
10
11 DatabaseError LeveldbStatusToError(const leveldb::Status& s) {
12 if (s.ok())
13 return DatabaseError::OK;
14 if (s.IsNotFound())
15 return DatabaseError::NOT_FOUND;
16 if (s.IsCorruption())
17 return DatabaseError::CORRUPTION;
18 if (s.IsNotSupportedError())
19 return DatabaseError::NOT_SUPPORTED;
20 if (s.IsIOError())
21 return DatabaseError::IO_ERROR;
22 return DatabaseError::INVALID_ARGUMENT;
23 }
24
25 leveldb::Slice GetSliceFor(const mojo::Array<uint8_t>& key) {
26 if (key.size() == 0)
27 return leveldb::Slice();
28 return leveldb::Slice(reinterpret_cast<const char*>(&key.front()),
29 key.size());
30 }
31
32 } // namespace leveldb
OLDNEW
« no previous file with comments | « components/leveldb/util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698