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

Side by Side Diff: google_apis/gcm/engine/gcm_store.h

Issue 121743002: Renaming RMQStore to GCMStore and breaking out its interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a GCM_EXPORT directive to GCMStoreImpl Created 6 years, 11 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 | « no previous file | google_apis/gcm/engine/gcm_store.cc » ('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 2014 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 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/memory/ref_counted.h"
15 #include "google_apis/gcm/base/gcm_export.h"
16
17 namespace google {
18 namespace protobuf {
19 class MessageLite;
20 } // namespace protobuf
21 } // namespace google
22
23 namespace gcm {
24
25 class MCSMessage;
26
27 // A GCM data store interface. GCM Store will handle persistence portion of RMQ,
28 // as well as store device and user checkin information.
29 class GCM_EXPORT GCMStore {
30 public:
31 // Container for Load(..) results.
32 struct GCM_EXPORT LoadResult {
33 LoadResult();
34 ~LoadResult();
35
36 bool success;
37 uint64 device_android_id;
38 uint64 device_security_token;
39 std::vector<std::string> incoming_messages;
40 std::map<std::string, google::protobuf::MessageLite*> outgoing_messages;
41 int64 next_serial_number;
42 std::map<std::string, int64> user_serial_numbers;
43 };
44
45 typedef std::vector<std::string> PersistentIdList;
46 // Note: callee receives ownership of |outgoing_messages|' values.
47 typedef base::Callback<void(const LoadResult& result)> LoadCallback;
48 typedef base::Callback<void(bool success)> UpdateCallback;
49
50 GCMStore();
51 virtual ~GCMStore();
52
53 // Load the data from persistent store and pass the initial state back to
54 // caller.
55 virtual void Load(const LoadCallback& callback) = 0;
56
57 // Clears the GCM store of all data.
58 virtual void Destroy(const UpdateCallback& callback) = 0;
59
60 // Sets this device's messaging credentials.
61 virtual void SetDeviceCredentials(uint64 device_android_id,
62 uint64 device_security_token,
63 const UpdateCallback& callback) = 0;
64
65 // Unacknowledged incoming message handling.
66 virtual void AddIncomingMessage(const std::string& persistent_id,
67 const UpdateCallback& callback) = 0;
68 virtual void RemoveIncomingMessage(const std::string& persistent_id,
69 const UpdateCallback& callback) = 0;
70 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids,
71 const UpdateCallback& callback) = 0;
72
73 // Unacknowledged outgoing messages handling.
74 virtual void AddOutgoingMessage(const std::string& persistent_id,
75 const MCSMessage& message,
76 const UpdateCallback& callback) = 0;
77 virtual void RemoveOutgoingMessage(const std::string& persistent_id,
78 const UpdateCallback& callback) = 0;
79 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids,
80 const UpdateCallback& callback) = 0;
81
82 // User serial number handling.
83 virtual void SetNextSerialNumber(int64 next_serial_number,
84 const UpdateCallback& callback) = 0;
85 virtual void AddUserSerialNumber(const std::string& username,
86 int64 serial_number,
87 const UpdateCallback& callback) = 0;
88 virtual void RemoveUserSerialNumber(const std::string& username,
89 const UpdateCallback& callback) = 0;
90
91 private:
92 DISALLOW_COPY_AND_ASSIGN(GCMStore);
93 };
94
95 } // namespace gcm
96
97 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | google_apis/gcm/engine/gcm_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698