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 enum ServerUpdateProcessingResult { 49 // Success. Update applied and stored in SERVER_* fields or dropped if 50 // irrelevant. 51 SUCCESS_PROCESSED, 52 53 // Success. Update details stored in SERVER_* fields, but wasn't applied. 54 SUCCESS_STORED, 55 56 // Update is illegally inconsistent with earlier updates. e.g. A bookmark 57 // becoming a folder. 58 FAILED_INCONSISTENT, 59 60 // Update is illegal when considered alone. e.g. broken UTF-8 in the name. 61 FAILED_CORRUPT, 62 63 // Only used by VerifyUpdate. Indicates that an update is valid. As 64 // VerifyUpdate cannot return SUCCESS_STORED, we reuse the value. 65 SUCCESS_VALID = SUCCESS_STORED 66 }; 67 68 // Different results from the verify phase will yield different methods of 69 // processing in the ProcessUpdates phase. The SKIP result means the entry 70 // doesn't go to the ProcessUpdates phase. 71 enum VerifyResult { 72 VERIFY_FAIL, 73 VERIFY_SUCCESS, 74 VERIFY_UNDELETE, 75 VERIFY_SKIP, 76 VERIFY_UNDECIDED 77 }; 78 79 enum VerifyCommitResult { 80 VERIFY_UNSYNCABLE, 81 VERIFY_OK, 82 }; 83 84 } // namespace syncer 85 86 #endif // SYNC_ENGINE_SYNCER_TYPES_H_ 87