OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... | |
21 } // namespace google | 21 } // namespace google |
22 | 22 |
23 namespace gcm { | 23 namespace gcm { |
24 | 24 |
25 class MCSMessage; | 25 class MCSMessage; |
26 | 26 |
27 // A GCM data store interface. GCM Store will handle persistence portion of RMQ, | 27 // A GCM data store interface. GCM Store will handle persistence portion of RMQ, |
28 // as well as store device and user checkin information. | 28 // as well as store device and user checkin information. |
29 class GCM_EXPORT GCMStore { | 29 class GCM_EXPORT GCMStore { |
30 public: | 30 public: |
31 // Part of load results storing user serial number mapping related values. | |
32 struct GCM_EXPORT SerialNumberMappings { | |
jianli
2014/01/15 01:07:09
nit: probably simpler to name as SerialNumberMap
fgorski
2014/01/15 01:29:21
map has implications.
| |
33 SerialNumberMappings(); | |
34 ~SerialNumberMappings(); | |
35 | |
36 int64 next_serial_number; | |
37 std::map<std::string, int64> user_serial_numbers; | |
38 }; | |
39 | |
31 // Container for Load(..) results. | 40 // Container for Load(..) results. |
32 struct GCM_EXPORT LoadResult { | 41 struct GCM_EXPORT LoadResult { |
33 LoadResult(); | 42 LoadResult(); |
34 ~LoadResult(); | 43 ~LoadResult(); |
35 | 44 |
36 bool success; | 45 bool success; |
37 uint64 device_android_id; | 46 uint64 device_android_id; |
38 uint64 device_security_token; | 47 uint64 device_security_token; |
39 std::vector<std::string> incoming_messages; | 48 std::vector<std::string> incoming_messages; |
40 std::map<std::string, google::protobuf::MessageLite*> outgoing_messages; | 49 std::map<std::string, google::protobuf::MessageLite*> outgoing_messages; |
41 int64 next_serial_number; | 50 SerialNumberMappings serial_number_mappings; |
42 std::map<std::string, int64> user_serial_numbers; | |
43 }; | 51 }; |
44 | 52 |
45 typedef std::vector<std::string> PersistentIdList; | 53 typedef std::vector<std::string> PersistentIdList; |
46 // Note: callee receives ownership of |outgoing_messages|' values. | 54 // Note: callee receives ownership of |outgoing_messages|' values. |
47 typedef base::Callback<void(const LoadResult& result)> LoadCallback; | 55 typedef base::Callback<void(const LoadResult& result)> LoadCallback; |
48 typedef base::Callback<void(bool success)> UpdateCallback; | 56 typedef base::Callback<void(bool success)> UpdateCallback; |
49 | 57 |
50 GCMStore(); | 58 GCMStore(); |
51 virtual ~GCMStore(); | 59 virtual ~GCMStore(); |
52 | 60 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 virtual void RemoveUserSerialNumber(const std::string& username, | 99 virtual void RemoveUserSerialNumber(const std::string& username, |
92 const UpdateCallback& callback) = 0; | 100 const UpdateCallback& callback) = 0; |
93 | 101 |
94 private: | 102 private: |
95 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 103 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
96 }; | 104 }; |
97 | 105 |
98 } // namespace gcm | 106 } // namespace gcm |
99 | 107 |
100 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 108 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
OLD | NEW |