OLD | NEW |
| (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 SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | |
6 #define SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "sync/base/sync_export.h" | |
11 #include "sync/internal_api/public/non_blocking_sync_common.h" | |
12 #include "sync/protocol/data_type_state.pb.h" | |
13 | |
14 namespace syncer_v2 { | |
15 class CommitQueue; | |
16 | |
17 // Interface used by sync backend to issue requests to a synced data type. | |
18 class SYNC_EXPORT ModelTypeProcessor { | |
19 public: | |
20 ModelTypeProcessor(); | |
21 virtual ~ModelTypeProcessor(); | |
22 | |
23 // Connect this processor to the sync engine via |commit_queue|. Once called, | |
24 // the processor will send any pending and future commits via this channel. | |
25 // This can only be called multiple times if the processor is disconnected | |
26 // (via the DataTypeController) in between. | |
27 virtual void ConnectSync(std::unique_ptr<CommitQueue> commit_queue) = 0; | |
28 | |
29 // Disconnect this processor from the sync engine. Change metadata will | |
30 // continue being processed and persisted, but no commits can be made until | |
31 // the next time sync is connected. | |
32 virtual void DisconnectSync() = 0; | |
33 | |
34 // Informs this object that some of its commit requests have been | |
35 // successfully serviced. | |
36 virtual void OnCommitCompleted( | |
37 const sync_pb::DataTypeState& type_state, | |
38 const CommitResponseDataList& response_list) = 0; | |
39 | |
40 // Informs this object that there are some incoming updates is should | |
41 // handle. | |
42 virtual void OnUpdateReceived( | |
43 const sync_pb::DataTypeState& type_state, | |
44 const UpdateResponseDataList& updates) = 0; | |
45 }; | |
46 | |
47 } // namespace syncer_v2 | |
48 | |
49 #endif // SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | |
OLD | NEW |