• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CLOUD_SYNC_CLOUD_MEDIA_DATA_SERVICE_H
17 #define OHOS_MEDIA_CLOUD_SYNC_CLOUD_MEDIA_DATA_SERVICE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "message_parcel.h"
23 #include "photos_dto.h"
24 #include "photos_vo.h"
25 #include "rdb_store.h"
26 #include "check_file_data_dto.h"
27 #include "media_operate_result_dto.h"
28 #include "aging_file_query_dto.h"
29 #include "cloud_media_data_dao.h"
30 #include "cloud_media_data_service_processor.h"
31 #include "cloud_media_common_dao.h"
32 #include "cloud_media_define.h"
33 
34 namespace OHOS::Media::CloudSync {
35 class EXPORT CloudMediaDataService {
36 public:
37     // 核查相关
38     int32_t UpdateDirty(const std::string &cloudId, const int32_t dirtyType);
39     int32_t UpdatePosition(const std::vector<std::string> &cloudIds, const int32_t position);
40     int32_t UpdateSyncStatus(const std::string &cloudId, const int32_t syncStatus);
41     int32_t UpdateThmStatus(const std::string &cloudId, const int32_t thmStatus);
42     int32_t GetAgingFile(const AgingFileQueryDto &queryDto, std::vector<PhotosDto> &photosDtos);
43     int32_t GetActiveAgingFile(const AgingFileQueryDto &queryDto, std::vector<PhotosDto> &photosDtos);
44     int32_t UpdateLocalFileDirty(const std::vector<std::string> &cloudIdList);
45 
46     // 缓存视频
47     int32_t GetVideoToCache(std::vector<PhotosDto> &photosDtos);
48 
49     // 大数据
50     std::vector<uint64_t> GetFilePosStat();
51     std::vector<uint64_t> GetCloudThmStat();
52     int32_t GetDirtyTypeStat(std::vector<uint64_t> &dirtyTypeStat);
53 
54 private:
55     enum {
56         // Index of File Position Statistic Info.
57         INDEX_LOCAL = 0,
58         INDEX_CLOUD = 1,
59         INDEX_LOCAL_AND_CLOUD = 2,
60         // Index of Cloud Thumbnail Statistic Info.
61         INDEX_DOWNLOADED = 0,
62         INDEX_LCD_TO_DOWNLOAD = 1,
63         INDEX_THM_TO_DOWNLOAD = 2,
64         INDEX_TO_DOWNLOAD = 3,
65     };
66 
67 private:
68     CloudMediaDataDao dataDao_;
69     CloudMediaDataServiceProcessor processor_;
70     CloudMediaCommonDao commonDao_;
71 };
72 }  // namespace OHOS::Media::CloudSync
73 #endif  // OHOS_MEDIA_CLOUD_SYNC_CLOUD_MEDIA_DATA_SERVICE_H