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_ENGINE_SYNCER_TYPES_H_
      6 #define SYNC_ENGINE_SYNCER_TYPES_H_
      7 
      8 // The intent of this is to keep all shared data types and enums for the syncer
      9 // in a single place without having dependencies between other files.
     10 namespace syncer {
     11 
     12 enum UpdateAttemptResponse {
     13   // Update was applied or safely ignored.
     14   SUCCESS,
     15 
     16   // The conditions described by the following enum values are not mutually
     17   // exclusive.  The list has been ordered according to priority in the case of
     18   // overlap, with highest priority first.
     19   //
     20   // For example, in the case where an item had both the IS_UNSYCNED and
     21   // IS_UNAPPLIED_UPDATE flags set (CONFLICT_SIMPLE), and a SERVER_PARENT_ID
     22   // that, if applied, would cause a directory loop (CONFLICT_HIERARCHY), and
     23   // specifics that we can't decrypt right now (CONFLICT_ENCRYPTION), the
     24   // UpdateApplicator would return CONFLICT_ENCRYPTION when attempting to
     25   // process the item.
     26   //
     27   // We do not attempt to resolve CONFLICT_HIERARCHY or CONFLICT_ENCRYPTION
     28   // items.  We will leave these updates unapplied and wait for the server
     29   // to send us newer updates that will resolve the conflict.
     30 
     31   // We were unable to decrypt/encrypt this server data. As such, we can't make
     32   // forward progress on this node, but because the passphrase may not arrive
     33   // until later we don't want to get the syncer stuck. See UpdateApplicator
     34   // for how this is handled.
     35   CONFLICT_ENCRYPTION,
     36 
     37   // These are some updates that, if applied, would violate the tree's
     38   // invariants.  Examples of this include the server adding children to locally
     39   // deleted directories and directory moves that would create loops.
     40   CONFLICT_HIERARCHY,
     41 
     42   // This indicates that item was modified both remotely (IS_UNAPPLIED_UPDATE)
     43   // and locally (IS_UNSYNCED).  We use the ConflictResolver to decide which of
     44   // the changes should take priority, or if we can possibly merge the data.
     45   CONFLICT_SIMPLE
     46 };
     47 
     48 // Different results from the verify phase will yield different methods of
     49 // processing in the ProcessUpdates phase. The SKIP result means the entry
     50 // doesn't go to the ProcessUpdates phase.
     51 enum VerifyResult {
     52   VERIFY_FAIL,
     53   VERIFY_SUCCESS,
     54   VERIFY_UNDELETE,
     55   VERIFY_SKIP,
     56   VERIFY_UNDECIDED
     57 };
     58 
     59 enum VerifyCommitResult {
     60   VERIFY_UNSYNCABLE,
     61   VERIFY_OK,
     62 };
     63 
     64 }  // namespace syncer
     65 
     66 #endif  // SYNC_ENGINE_SYNCER_TYPES_H_
     67