1// Copyright (c) 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_INTERNAL_API_PUBLIC_ENGINE_STATUS_SUMMARY_H_
6#define SYNC_INTERNAL_API_PUBLIC_ENGINE_STATUS_SUMMARY_H_
7
8#include <string>
9
10#include "base/time/time.h"
11#include "sync/base/sync_export.h"
12#include "sync/internal_api/public/base/model_type.h"
13#include "sync/internal_api/public/sync_encryption_handler.h"
14#include "sync/protocol/sync_protocol_error.h"
15
16namespace syncer {
17
18// Status encapsulates detailed state about the internals of the SyncManager.
19//
20// This struct is closely tied to the AllStatus object which uses instances of
21// it to track and report on the sync engine's internal state, and the functions
22// in sync_ui_util.cc which convert the contents of this struct into a
23// DictionaryValue used to populate the about:sync summary tab.
24struct SYNC_EXPORT SyncStatus {
25  SyncStatus();
26  ~SyncStatus();
27
28  // TODO(akalin): Replace this with a NotificationsDisabledReason
29  // variable.
30  bool notifications_enabled;  // True only if subscribed for notifications.
31
32  // Notifications counters updated by the actions in synapi.
33  int notifications_received;
34
35  SyncProtocolError sync_protocol_error;
36
37  // Number of encryption conflicts counted during most recent sync cycle.
38  int encryption_conflicts;
39
40  // Number of hierarchy conflicts counted during most recent sync cycle.
41  int hierarchy_conflicts;
42
43  // Number of items the server refused to commit due to conflict during most
44  // recent sync cycle.
45  int server_conflicts;
46
47  // Number of items successfully committed during most recent sync cycle.
48  int committed_count;
49
50  bool syncing;
51
52  // Total updates received by the syncer since browser start.
53  int updates_received;
54  // Total updates received that are echoes of our own changes.
55  int reflected_updates_received;
56  // Of updates_received, how many were tombstones.
57  int tombstone_updates_received;
58
59  // Total successful commits.
60  int num_commits_total;
61
62  // Total number of overwrites due to conflict resolver since browser start.
63  int num_local_overwrites_total;
64  int num_server_overwrites_total;
65
66  // Nudge counts for each possible source
67  int nudge_source_notification;
68  int nudge_source_local;
69  int nudge_source_local_refresh;
70
71  // Encryption related.
72  ModelTypeSet encrypted_types;
73  bool cryptographer_ready;
74  bool crypto_has_pending_keys;
75  bool has_keystore_key;
76  base::Time keystore_migration_time;
77  PassphraseType passphrase_type;
78
79  // Per-datatype throttled status.
80  ModelTypeSet throttled_types;
81
82  // The unique identifer for the sync store.
83  std::string sync_id;
84
85  // The unique identifier for the invalidation client.
86  std::string invalidator_client_id;
87
88  // Counters grouped by model type
89  std::vector<int> num_entries_by_type;
90  std::vector<int> num_to_delete_entries_by_type;
91
92  // Time of next retry if sync scheduler is throttled or in backoff.
93  base::Time retry_time;
94};
95
96}  // namespace syncer
97
98#endif  // SYNC_INTERNAL_API_PUBLIC_ENGINE_STATUS_SUMMARY_H_
99