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 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
14using std::vector;
15
16namespace syncer {
17
18namespace syncable {
19class BaseTransaction;
20}
21
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
26// one where parents are placed before children, predecessors are placed before
27// successors, and deletes appear after creates and moves.
28//
29// The predecessor to successor rule was implemented when we tracked positions
30// within a folder that was sensitive to such things.  The current positioning
31// system can handle receiving the elements within a folder out of order, so we
32// may be able to remove that functionality in the future.
33// See crbug.com/287938.
34SYNC_EXPORT_PRIVATE void GetCommitIdsForType(
35    syncable::BaseTransaction* trans,
36    ModelType type,
37    size_t max_entries,
38    std::vector<int64>* out);
39
40}  // namespace syncer
41
42#endif  // SYNC_ENGINE_GET_COMMIT_IDS_H_
43