OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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_IMPL_H_ | |
6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "google_apis/gcm/base/gcm_export.h" | |
11 #include "google_apis/gcm/engine/gcm_store.h" | |
12 | |
13 namespace base { | |
14 class FilePath; | |
15 class SequencedTaskRunner; | |
16 } // namespace base | |
17 | |
18 namespace gcm { | |
19 | |
20 // A Reliable Message Queue store. | |
Nicolas Zea
2013/12/27 20:03:06
Update comment.
fgorski
2013/12/27 22:20:39
Done.
| |
21 // Will perform all blocking operations on the blocking task runner, and will | |
22 // post all callbacks to the thread on which the GCMStore is created. | |
23 class GCMStoreImpl : public GCMStore { | |
24 public: | |
25 GCMStoreImpl(const base::FilePath& path, | |
26 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | |
27 virtual ~GCMStoreImpl(); | |
28 | |
29 // Load the directory and pass the initial state back to caller. | |
30 virtual void Load(const LoadCallback& callback) OVERRIDE; | |
31 | |
32 // Clears the RMQ store of all data and destroys any LevelDB files associated | |
33 // with this store. | |
34 // WARNING: this will permanently destroy any pending outgoing messages | |
35 // and require the device to re-create credentials. | |
36 virtual void Destroy(const UpdateCallback& callback) OVERRIDE; | |
37 | |
38 // Sets this device's messaging credentials. | |
39 virtual void SetDeviceCredentials(uint64 device_android_id, | |
40 uint64 device_security_token, | |
41 const UpdateCallback& callback) OVERRIDE; | |
42 | |
43 // Unacknowledged incoming message handling. | |
44 virtual void AddIncomingMessage(const std::string& persistent_id, | |
45 const UpdateCallback& callback) OVERRIDE; | |
46 virtual void RemoveIncomingMessage(const std::string& persistent_id, | |
47 const UpdateCallback& callback) OVERRIDE; | |
48 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids, | |
49 const UpdateCallback& callback) OVERRIDE; | |
50 | |
51 // Unacknowledged outgoing messages handling. | |
52 // TODO(zea): implement per-app limits on the number of outgoing messages. | |
53 virtual void AddOutgoingMessage(const std::string& persistent_id, | |
54 const MCSMessage& message, | |
55 const UpdateCallback& callback) OVERRIDE; | |
56 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | |
57 const UpdateCallback& callback) OVERRIDE; | |
58 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | |
59 const UpdateCallback& callback) OVERRIDE; | |
60 | |
61 // User serial number handling. | |
62 virtual void SetNextSerialNumber(int64 next_serial_number, | |
63 const UpdateCallback& callback) OVERRIDE; | |
64 virtual void AddUserSerialNumber(const std::string& username, | |
65 int64 serial_number, | |
66 const UpdateCallback& callback) OVERRIDE; | |
67 virtual void RemoveUserSerialNumber(const std::string& username, | |
68 const UpdateCallback& callback) OVERRIDE; | |
69 | |
70 private: | |
71 class Backend; | |
72 | |
73 scoped_refptr<Backend> backend_; | |
74 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); | |
77 }; | |
78 | |
79 } // namespace gcm | |
80 | |
81 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | |
OLD | NEW |