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_PROCESS_UPDATES_UTIL_H_
6#define SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
7
8#include <vector>
9
10#include "sync/internal_api/public/base/model_type.h"
11
12namespace sync_pb {
13class SyncEntity;
14}
15
16namespace syncer {
17
18namespace sessions {
19class StatusController;
20}
21
22namespace syncable {
23class ModelNeutralWriteTransaction;
24class Directory;
25}
26
27struct UpdateCounters;
28
29typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
30
31// Processes all the updates associated with a single ModelType.
32void ProcessDownloadedUpdates(
33    syncable::Directory* dir,
34    syncable::ModelNeutralWriteTransaction* trans,
35    ModelType type,
36    const SyncEntityList& applicable_updates,
37    sessions::StatusController* status,
38    UpdateCounters* counters);
39
40// Tombstones all entries of |type| whose versions are older than
41// |version_watermark| unless they are type root or unsynced/unapplied.
42void ExpireEntriesByVersion(syncable::Directory* dir,
43                            syncable::ModelNeutralWriteTransaction* trans,
44                            ModelType type,
45                            int64 version_watermark);
46
47}  // namespace syncer
48
49#endif  // SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
50