OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 SYNC_ENGINE_GET_COMMIT_IDS_H_ | 5 #ifndef SYNC_ENGINE_GET_COMMIT_IDS_H_ |
6 #define SYNC_ENGINE_GET_COMMIT_IDS_H_ | 6 #define SYNC_ENGINE_GET_COMMIT_IDS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "sync/base/sync_export.h" | 10 #include "sync/base/sync_export.h" |
11 #include "sync/internal_api/public/base/model_type.h" | 11 #include "sync/internal_api/public/base/model_type.h" |
12 #include "sync/syncable/directory.h" | 12 #include "sync/syncable/directory.h" |
13 | 13 |
14 using std::vector; | 14 using std::vector; |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 | 17 |
18 namespace sessions { | |
19 class OrderedCommitSet; | |
20 } | |
21 | |
22 namespace syncable { | 18 namespace syncable { |
23 class BaseTransaction; | 19 class BaseTransaction; |
24 } | 20 } |
25 | 21 |
26 // These functions return handles in "commit order". A valid commit ordering is | 22 // Returns up to |max_entries| metahandles of entries that belong to the |
| 23 // specified |type| and are ready for commit. |
| 24 // |
| 25 // This function returns handles in "commit order". A valid commit ordering is |
27 // one where parents are placed before children, predecessors are placed before | 26 // one where parents are placed before children, predecessors are placed before |
28 // successors, and deletes appear after creates and moves. | 27 // successors, and deletes appear after creates and moves. |
29 // | 28 // |
30 // The predecessor to successor rule was implemented when we tracked positions | 29 // The predecessor to successor rule was implemented when we tracked positions |
31 // within a folder that was sensitive to such things. The current positioning | 30 // within a folder that was sensitive to such things. The current positioning |
32 // system can handle receiving the elements within a folder out of order, so we | 31 // system can handle receiving the elements within a folder out of order, so we |
33 // may be able to remove that functionality in the future. | 32 // may be able to remove that functionality in the future. |
34 // See crbug.com/287938. | 33 // See crbug.com/287938. |
35 | |
36 // Returns up to |max_entries| metahandles of entries that belong to the | |
37 // specified |type| and are ready for commit. The returned handles will be | |
38 // in a valid commit ordering. | |
39 SYNC_EXPORT_PRIVATE void GetCommitIdsForType( | 34 SYNC_EXPORT_PRIVATE void GetCommitIdsForType( |
40 syncable::BaseTransaction* trans, | 35 syncable::BaseTransaction* trans, |
41 ModelType type, | 36 ModelType type, |
42 size_t max_entries, | 37 size_t max_entries, |
43 std::vector<int64>* out); | 38 std::vector<int64>* out); |
44 | 39 |
45 // Fills the specified |ordered_commit_set| with up to |commit_batch_size| | |
46 // metahandles that belong to the set of types |requested_types| and are ready | |
47 // for commit. The list will be in a valid commit ordering. | |
48 SYNC_EXPORT_PRIVATE void GetCommitIds( | |
49 syncable::BaseTransaction* trans, | |
50 ModelTypeSet requested_types, | |
51 size_t commit_batch_size, | |
52 sessions::OrderedCommitSet* ordered_commit_set); | |
53 | |
54 } // namespace syncer | 40 } // namespace syncer |
55 | 41 |
56 #endif // SYNC_ENGINE_GET_COMMIT_IDS_H_ | 42 #endif // SYNC_ENGINE_GET_COMMIT_IDS_H_ |
OLD | NEW |