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

Side by Side Diff: content/common/leveldb_wrapper.mojom

Issue 1745603002: Switch LevelDBWrapper::GetAll to use the new Mojo sync IPC mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 4 years, 9 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
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 module content; 5 module content;
6 6
7 import "components/leveldb/public/interfaces/leveldb.mojom"; 7 import "components/leveldb/public/interfaces/leveldb.mojom";
8 8
9 // Gives information about changes to a LevelDB database.
10 // The reason this is a parameter to DeleteAll and GetAll below, instead of
11 // being specified when opening a LevelDBWrapper, is to avoid the client getting
12 // callbacks for changes that have already been applied to its database that
13 // it's fetching via GetAll or it's clearing via DeleteAll.
14 interface LevelDBObserver {
15 KeyChanged(array<uint8> key, array<uint8> new_value, array<uint8> old_value,
16 string source);
17 KeyDeleted(array<uint8> key, string source);
18 AllDeleted(string source);
19 };
20
9 struct KeyValue { 21 struct KeyValue {
10 array<uint8> key; 22 array<uint8> key;
11 array<uint8> value; 23 array<uint8> value;
12 }; 24 };
13 25
14 // A wrapper around leveldb that supports giving notifications when values 26 // A wrapper around leveldb that supports giving notifications when values
15 // change. 27 // change.
16 interface LevelDBWrapper { 28 interface LevelDBWrapper {
17 // Sets the database entry for "key" to "value". Returns OK on success. 29 // Sets the database entry for "key" to "value". Returns OK on success.
18 Put(array<uint8> key, array<uint8> value, string source) 30 Put(array<uint8> key, array<uint8> value, string source)
19 => (leveldb.DatabaseError status); 31 => (leveldb.DatabaseError status);
20 32
21 // Remove the database entry (if any) for "key". Returns OK on 33 // Remove the database entry (if any) for "key". Returns OK on
22 // success, and a non-OK status on error. It is not an error if "key" 34 // success, and a non-OK status on error. It is not an error if "key"
23 // did not exist in the database. 35 // did not exist in the database.
24 Delete(array<uint8> key, string source) => (leveldb.DatabaseError status); 36 Delete(array<uint8> key, string source) => (leveldb.DatabaseError status);
25 37
26 // Removes all the entries. 38 // Removes all the entries.
27 DeleteAll(string source) => (leveldb.DatabaseError status); 39 DeleteAll(LevelDBObserver observer, string source)
40 => (leveldb.DatabaseError status);
28 41
29 // Returns the value of the given key. 42 // Returns the value of the given key.
30 Get(array<uint8> key) => (leveldb.DatabaseError status, array<uint8> value); 43 Get(array<uint8> key) => (leveldb.DatabaseError status, array<uint8> value);
31 44
32 // Only used with small databases. Returns all key/value pairs. 45 // Only used with small databases. Returns all key/value pairs.
33 GetAll() => (leveldb.DatabaseError status, array<KeyValue> data); 46 [Sync]
47 GetAll(LevelDBObserver observer)
48 => (leveldb.DatabaseError status, array<KeyValue> data);
34 }; 49 };
35
36 // Gives information about changes to a LevelDB database.
37 interface LevelDBObserver {
38 KeyChanged(array<uint8> key, array<uint8> new_value, array<uint8> old_value,
39 string source);
40 KeyDeleted(array<uint8> key, string source);
41 AllDeleted(string source);
42 };
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl.cc ('k') | content/common/storage_partition_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698