1 /*
2 * Copyright (c) 2023 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 #ifndef OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
16 #define OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
17
18 #include "medialibrary_db_const.h"
19 #include "medialibrary_type_const.h"
20 #include "photo_album_column.h"
21 #include "photo_map_column.h"
22 #include <set>
23 #include <string>
24 namespace OHOS::FileManagement::CloudSync {
25
26 enum CleanAction {
27 RETAIN_DATA = 0,
28 CLEAR_DATA
29 };
30
31 enum class SyncTriggerType : int32_t {
32 APP_TRIGGER,
33 CLOUD_TRIGGER,
34 PENDING_TRIGGER,
35 BATTERY_OK_TRIGGER,
36 NETWORK_AVAIL_TRIGGER,
37 TASK_TRIGGER,
38 };
39
40 enum class ThumbState : int32_t {
41 DOWNLOADED,
42 LCD_TO_DOWNLOAD,
43 THM_TO_DOWNLOAD,
44 TO_DOWNLOAD,
45 };
46
47 struct LocalInfo {
48 int64_t mdirtyTime;
49 int64_t fdirtyTime;
50 };
51
52 const int32_t POSITION_LOCAL = 1;
53 const int32_t POSITION_CLOUD = 2;
54 const int32_t POSITION_BOTH = 3;
55
56 const int32_t FILE = 0;
57 const int32_t DIRECTORY = 1;
58
59 const int32_t MILLISECOND_TO_SECOND = 1000;
60 const int32_t SECOND_TO_MILLISECOND = 1000;
61
62 const std::string GALLERY_BUNDLE_NAME = "com.ohos.photos";
63 const std::string MEDIALIBRARY_BUNDLE_NAME = "com.ohos.medialibrary.medialibrarydata";
64
GetCurrentTimeStamp()65 static inline uint64_t GetCurrentTimeStamp()
66 {
67 struct timespec t;
68 clock_gettime(CLOCK_REALTIME, &t);
69 return t.tv_sec * SECOND_TO_MILLISECOND + t.tv_nsec / SECOND_TO_MILLISECOND;
70 }
71 } // namespace OHOS::FileManagement::CloudSync
72 #endif // OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
73