1 /* 2 * Copyright (C) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_MEDIA_DFX_CLOUD_CONST_H 17 #define OHOS_MEDIA_DFX_CLOUD_CONST_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace Media { 23 constexpr uint32_t DOWNLOAD_META_LEN = 5; 24 constexpr uint32_t DOWNLOAD_THUMB_LEN = 5; 25 constexpr uint32_t DOWNLOAD_LCD_LEN = 5; 26 constexpr uint32_t DOWNLOAD_ALBUM_LEN = 4; 27 constexpr uint32_t UPLOAD_META_LEN = 6; 28 constexpr uint32_t UPLOAD_ALBUM_LEN = 4; 29 constexpr uint32_t UPLOAD_META_ERR_LEN = 8; 30 constexpr uint32_t UPDATE_DETAILS_LEN = 9; 31 constexpr uint32_t CLOUD_SPACE_FULL = 30; 32 33 enum SyncStatIndex { 34 /* download */ 35 INDEX_DL_META_SUCCESS, 36 INDEX_DL_META_ERROR_SDK, 37 INDEX_DL_META_ERROR_DATA, 38 INDEX_DL_META_ERROR_IO, 39 INDEX_DL_META_ERROR_RDB, 40 41 /* upload */ 42 INDEX_UL_META_SUCCESS, 43 INDEX_UL_META_ERROR_SDK, 44 INDEX_UL_META_ERROR_DATA, 45 INDEX_UL_META_ERROR_IO, 46 INDEX_UL_META_ERROR_ATTACHMENT, 47 INDEX_UL_META_ERROR_RDB, 48 }; 49 50 enum SyncType { 51 META_DL_INSERT = 1, 52 META_DL_DELETE, 53 META_DL_UPDATE, 54 META_UL_INSERT, 55 META_UL_DELETE, 56 META_UL_MODIFY_MDIRTY, 57 META_UL_MODIFY_FDIRTY, 58 META_UL_MODIFY_COPY, 59 }; 60 61 enum SyncAttachmentIndex { 62 INDEX_THUMB_SUCCESS, 63 INDEX_THUMB_ERROR_SDK, 64 INDEX_THUMB_ERROR_DATA, 65 INDEX_THUMB_ERROR_IO, 66 INDEX_THUMB_ERROR_RDB, 67 68 INDEX_LCD_SUCCESS, 69 INDEX_LCD_ERROR_SDK, 70 INDEX_LCD_ERROR_DATA, 71 INDEX_LCD_ERROR_IO, 72 INDEX_LCD_ERROR_RDB 73 }; 74 75 enum AlbumStatIndex { 76 /* download */ 77 INDEX_DL_ALBUM_SUCCESS, 78 INDEX_DL_ALBUM_SDK, 79 INDEX_DL_ALBUM_DATA, 80 INDEX_DL_ALBUM_RDB, 81 82 /* upload */ 83 INDEX_UL_ALBUM_SUCCESS, 84 INDEX_UL_ALBUM_SDK, 85 INDEX_UL_ALBUM_DATA, 86 INDEX_UL_ALBUM_RDB 87 }; 88 89 enum UploadMetaErrIndex { 90 INDEX_UL_META_ERR_SUCCESS, 91 INDEX_UL_META_ERR_PERMISSION, 92 INDEX_UL_META_ERR_STORAGE, 93 INDEX_UL_META_ERR_NETWORK, 94 INDEX_UL_META_ERR_ERR1, 95 INDEX_UL_META_ERR_ERR2, 96 INDEX_UL_META_ERR_ERR3, 97 INDEX_UL_META_ERR_OTHER 98 }; 99 100 enum class FaultScenario { 101 CLOUD_SYNC_PULL = 100, 102 CLOUD_SYNC_PUSH = 200, 103 CLOUD_SYNC_CHECK = 300, 104 CLOUD_DOWNLOAD_FILE = 600, 105 CLOUD_DOWNLOAD_THUM = 700, 106 MEDIA_ANALYSIS = 800, 107 MEDIA_REFRESH = 900, 108 MEDIA_BACKUP = 1000, 109 MEDIA_SCAN = 1100, 110 }; 111 112 enum class FaultType { 113 FILE = 10000000, 114 115 TIMEOUT = 30000000, 116 117 TEMPERATURE = 40000000, 118 119 DATABASE = 50000000, 120 QUERY_DATABASE = 50000001, 121 INSERT_DATABASE = 50000002, 122 DELETE_DATABASE = 50000003, 123 MODIFY_DATABASE = 50000004, 124 125 CONSISTENCY = 60000000, 126 FILE_CONSISTENCY = 60000001, 127 META_CONSISTENCY = 60000002, 128 129 INNER_ERROR = 90000000, 130 131 WARNING = 100000000 132 }; 133 134 struct CloudSyncInfo { 135 uint64_t startTime{0}; 136 uint64_t duration{0}; 137 int32_t syncReason{0}; 138 int32_t stopReason{0}; 139 }; 140 141 struct CloudSyncStat { 142 std::vector<uint64_t> downloadMeta; 143 std::vector<uint64_t> uploadMeta; 144 std::vector<uint64_t> downloadThumb; 145 std::vector<uint64_t> downloadLcd; 146 std::vector<uint64_t> uploadAlbum; 147 std::vector<uint64_t> downloadAlbum; 148 std::vector<uint64_t> updateDetails; 149 std::vector<uint64_t> uploadMetaErr; 150 }; 151 152 struct SyncFaultEvent { 153 FaultScenario scenario; 154 FaultType type; 155 int32_t errorCode; 156 std::string message; 157 }; 158 159 } // namespace Media 160 } // namespace OHOS 161 162 #endif // OHOS_MEDIA_DFX_CLOUD_CONST_H