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

Side by Side Diff: sync/engine/get_commit_ids.h

Issue 23809005: sync: Implement per-type GetCommitIds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments + algorithm improvements Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 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_ENGINE_GET_COMMIT_IDS_H_
6 #define SYNC_ENGINE_GET_COMMIT_IDS_H_
7
8 #include <vector>
9
10 #include "sync/base/sync_export.h"
11 #include "sync/internal_api/public/base/model_type.h"
12 #include "sync/syncable/directory.h"
13
14 using std::vector;
15
16 namespace syncer {
17
18 namespace sessions {
19 class OrderedCommitSet;
20 }
21
22 namespace syncable {
23 class BaseTransaction;
24 }
25
26 // Filters |unsynced_handles| to remove all entries that do not belong to the
27 // specified |requested_types|, or are not eligible for a commit at this time.
28 SYNC_EXPORT_PRIVATE void FilterUnreadyEntries(
29 syncable::BaseTransaction* trans,
30 ModelTypeSet requested_types,
31 ModelTypeSet encrypted_types,
32 bool passphrase_missing,
33 const syncable::Directory::Metahandles& unsynced_handles,
34 std::set<int64>* ready_unsynced_set);
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 // sorted for commit.
39 SYNC_EXPORT_PRIVATE void GetCommitIdsForType(
40 syncable::BaseTransaction* trans,
41 ModelType type,
42 const size_t max_entries,
Nicolas Zea 2013/09/05 23:55:37 no need for const on size_t (here and below)
rlarocque 2013/09/06 18:58:26 Done.
43 std::vector<int64>* out);
44
45 // Given a set of commit metahandles that are ready for commit
46 // (|ready_unsynced_set|), sorts these into commit order and places up to
47 // |max_entries| of them in the output parameter |out|.
48 //
49 // In "commit order", the metahandles are ordered so that parents are before
50 // children, and predecessors are before successors. Deletions are always
51 // placed last.
52 //
53 // Since the implementation of UniquePositions, it is probably no longer
54 // necessary to put predecessors before successors. That functionality may be
55 // removed in the future.
56 SYNC_EXPORT_PRIVATE void OrderCommitIds(
57 syncable::BaseTransaction* trans,
58 size_t max_entries,
59 const std::set<int64>& ready_unsynced_set,
60 std::vector<int64>* out);
61
62 // Fills the specified |ordered_commit_set| with up to |commit_batch_size|
63 // metahandles that belong to the set of types |requested_types| and are ready
64 // for commit.
65 //
66 // The list will be sorted for commit.
67 SYNC_EXPORT_PRIVATE void GetCommitIds(
Nicolas Zea 2013/09/05 23:55:37 Are any of the other methods beyond this one used
rlarocque 2013/09/06 18:58:26 No, but I would like to keep their implementations
68 syncable::BaseTransaction* trans,
69 ModelTypeSet requested_types,
70 const size_t commit_batch_size,
71 sessions::OrderedCommitSet* ordered_commit_set);
72
73 } // namespace syncer
74
75 #endif // SYNC_ENGINE_GET_COMMIT_IDS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698