Home | History | Annotate | Download | only in engine
      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 
     16 namespace 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.
     24 struct 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 available.  If zero, nothing left to download.
     53   int64 updates_available;
     54   // Total updates received by the syncer since browser start.
     55   int updates_received;
     56   // Total updates received that are echoes of our own changes.
     57   int reflected_updates_received;
     58   // Of updates_received, how many were tombstones.
     59   int tombstone_updates_received;
     60 
     61   // Total successful commits.
     62   int num_commits_total;
     63 
     64   // Total number of overwrites due to conflict resolver since browser start.
     65   int num_local_overwrites_total;
     66   int num_server_overwrites_total;
     67 
     68   // Count of empty and non empty getupdates;
     69   int nonempty_get_updates;
     70   int empty_get_updates;
     71 
     72   // Count of sync cycles that successfully committed items;
     73   int sync_cycles_with_commits;
     74   int sync_cycles_without_commits;
     75 
     76   // Count of useless and useful syncs we perform.
     77   int useless_sync_cycles;
     78   int useful_sync_cycles;
     79 
     80   // Nudge counts for each possible source
     81   int nudge_source_notification;
     82   int nudge_source_local;
     83   int nudge_source_local_refresh;
     84 
     85   // Encryption related.
     86   ModelTypeSet encrypted_types;
     87   bool cryptographer_ready;
     88   bool crypto_has_pending_keys;
     89   bool has_keystore_key;
     90   base::Time keystore_migration_time;
     91   PassphraseType passphrase_type;
     92 
     93   // Per-datatype throttled status.
     94   ModelTypeSet throttled_types;
     95 
     96   // The unique identifer for the sync store.
     97   std::string sync_id;
     98 
     99   // The unique identifier for the invalidation client.
    100   std::string invalidator_client_id;
    101 
    102   // Counters grouped by model type
    103   std::vector<int> num_entries_by_type;
    104   std::vector<int> num_to_delete_entries_by_type;
    105 
    106   // Time of next retry if sync scheduler is throttled or in backoff.
    107   base::Time retry_time;
    108 };
    109 
    110 }  // namespace syncer
    111 
    112 #endif  // SYNC_INTERNAL_API_PUBLIC_ENGINE_STATUS_SUMMARY_H_
    113