Home | History | Annotate | Download | only in sync_file_system
      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 CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
      6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
      7 
      8 #include <string>
      9 
     10 #include "base/platform_file.h"
     11 
     12 namespace leveldb {
     13 class Status;
     14 }
     15 
     16 namespace sync_file_system {
     17 
     18 enum SyncStatusCode {
     19   SYNC_STATUS_OK = 0,
     20   SYNC_STATUS_UNKNOWN = -1000,
     21 
     22   // Generic error code which is not specifically related to a specific
     23   // submodule error code (yet).
     24   SYNC_STATUS_FAILED = -1001,
     25 
     26   // Basic ones that could be directly mapped to PlatformFileError.
     27   SYNC_FILE_ERROR_FAILED = -1,
     28   SYNC_FILE_ERROR_IN_USE = -2,
     29   SYNC_FILE_ERROR_EXISTS = -3,
     30   SYNC_FILE_ERROR_NOT_FOUND = -4,
     31   SYNC_FILE_ERROR_ACCESS_DENIED = -5,
     32   SYNC_FILE_ERROR_TOO_MANY_OPENED = -6,
     33   SYNC_FILE_ERROR_NO_MEMORY = -7,
     34   SYNC_FILE_ERROR_NO_SPACE = -8,
     35   SYNC_FILE_ERROR_NOT_A_DIRECTORY = -9,
     36   SYNC_FILE_ERROR_INVALID_OPERATION = -10,
     37   SYNC_FILE_ERROR_SECURITY = -11,
     38   SYNC_FILE_ERROR_ABORT = -12,
     39   SYNC_FILE_ERROR_NOT_A_FILE = -13,
     40   SYNC_FILE_ERROR_NOT_EMPTY = -14,
     41   SYNC_FILE_ERROR_INVALID_URL = -15,
     42   SYNC_FILE_ERROR_IO = -16,
     43 
     44   // Database related errors.
     45   SYNC_DATABASE_ERROR_NOT_FOUND = -50,
     46   SYNC_DATABASE_ERROR_CORRUPTION = -51,
     47   SYNC_DATABASE_ERROR_IO_ERROR = -52,
     48   SYNC_DATABASE_ERROR_FAILED = -53,
     49 
     50   // Sync specific status code.
     51   SYNC_STATUS_FILE_BUSY = -100,
     52   SYNC_STATUS_HAS_CONFLICT = -101,
     53   SYNC_STATUS_NO_CONFLICT = -102,
     54   SYNC_STATUS_ABORT = -103,
     55   SYNC_STATUS_NO_CHANGE_TO_SYNC = -104,
     56   SYNC_STATUS_SERVICE_TEMPORARILY_UNAVAILABLE = -105,
     57   SYNC_STATUS_NETWORK_ERROR = -106,
     58   SYNC_STATUS_AUTHENTICATION_FAILED = -107,
     59   SYNC_STATUS_UNKNOWN_ORIGIN = -108,
     60   SYNC_STATUS_NOT_MODIFIED = -109,
     61   SYNC_STATUS_SYNC_DISABLED = -110,
     62   SYNC_STATUS_ACCESS_FORBIDDEN = -111,
     63   SYNC_STATUS_RETRY = -112,
     64 };
     65 
     66 const char* SyncStatusCodeToString(SyncStatusCode status);
     67 
     68 SyncStatusCode LevelDBStatusToSyncStatusCode(const leveldb::Status& status);
     69 
     70 SyncStatusCode PlatformFileErrorToSyncStatusCode(
     71     base::PlatformFileError file_error);
     72 
     73 base::PlatformFileError SyncStatusCodeToPlatformFileError(
     74     SyncStatusCode status);
     75 
     76 }  // namespace sync_file_system
     77 
     78 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_
     79