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

Unified Diff: components/leveldb_proto/proto_database.h

Issue 2049573003: Implement ProtoDatabase::GetEntry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/leveldb_proto/proto_database.h
diff --git a/components/leveldb_proto/proto_database.h b/components/leveldb_proto/proto_database.h
index 30949bf3bdf3ddd25b4c74a5a311507dde2abcd4..28c8d3c5e42a2bcc346a0be1d725dad709241cf3 100644
--- a/components/leveldb_proto/proto_database.h
+++ b/components/leveldb_proto/proto_database.h
@@ -27,6 +27,7 @@ class ProtoDatabase {
using UpdateCallback = base::Callback<void(bool success)>;
using LoadCallback =
base::Callback<void(bool success, std::unique_ptr<std::vector<T>>)>;
+ using GetCallback = base::Callback<void(bool success, std::unique_ptr<T>)>;
using DestroyCallback = base::Callback<void(bool success)>;
// A list of key-value (string, T) tuples.
@@ -52,6 +53,11 @@ class ProtoDatabase {
// when complete.
virtual void LoadEntries(const LoadCallback& callback) = 0;
+ // Asynchronously loads a single entry, identified by |key|, from the database
+ // and invokes |callback| when complete.
+ virtual void GetEntry(const std::string& key,
+ const GetCallback& callback) = 0;
+
// Asynchronously destroys the database.
virtual void Destroy(const DestroyCallback& callback) = 0;
};

Powered by Google App Engine
This is Rietveld 408576698