1 /* 2 * Copyright (c) 2024 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_FILE_DATA_SYNC_MANAGER_H 16 #define OHOS_CLOUD_FILE_DATA_SYNC_MANAGER_H 17 18 #include <bitset> 19 #include <memory> 20 21 #include "data_sync_const.h" 22 #include "i_cloud_download_callback.h" 23 #include "i_cloud_sync_callback.h" 24 25 namespace OHOS::FileManagement::CloudFile { 26 class DataSyncManager { 27 public: 28 using BundleNameUserInfo = CloudSync::BundleNameUserInfo; 29 using SyncTriggerType = CloudSync::SyncTriggerType; 30 DataSyncManager() = default; 31 virtual ~DataSyncManager() = default; 32 33 virtual int32_t TriggerStartSync(const std::string &bundleName, 34 const int32_t userId, 35 bool forceFlag, 36 SyncTriggerType triggerType, 37 std::string prepareTraceId = ""); 38 virtual int32_t TriggerStopSync(const std::string &bundleName, const int32_t userId, 39 bool forceFlag, SyncTriggerType triggerType); 40 virtual int32_t TriggerRecoverySync(SyncTriggerType triggerType); 41 virtual int32_t StopUploadTask(const std::string &bundleName, const int32_t userId); 42 virtual int32_t ResetCursor(const std::string &bundleName, const int32_t &userId); 43 virtual void RegisterCloudSyncCallback(const std::string &bundleName, 44 const std::string &callerBundleName, 45 const int32_t userId, 46 const sptr<CloudSync::ICloudSyncCallback> &callback); 47 virtual void UnRegisterCloudSyncCallback(const std::string &bundleName, const std::string &callerBundleName); 48 virtual int32_t IsSkipSync(const std::string &bundleName, const int32_t userId, bool forceFlag); 49 virtual int32_t StartDownloadFile(const BundleNameUserInfo &bundleNameUserInfo, 50 const std::vector<std::string> pathVec, 51 int64_t &downloadId, 52 std::bitset<FIELD_KEY_MAX_SIZE> fieldkey, 53 const sptr<CloudSync::ICloudDownloadCallback> &downloadCallback); 54 virtual int32_t StopDownloadFile(const BundleNameUserInfo &bundleNameUserInfo, 55 const std::string path, 56 bool needClean = false); 57 virtual int32_t StopFileCache(const BundleNameUserInfo &bundleNameUserInfo, 58 const int64_t &downloadId, 59 bool needClean); 60 virtual int32_t RegisterDownloadFileCallback(const BundleNameUserInfo &bundleNameUserInfo, 61 const sptr<CloudSync::ICloudDownloadCallback> &downloadCallback); 62 virtual int32_t UnregisterDownloadFileCallback(const BundleNameUserInfo &bundleNameUserInfo); 63 virtual int32_t CleanCloudFile(const int32_t userId, const std::string &bundleName, const int action); 64 virtual int32_t CleanRemainFile(const std::string &bundleName, const int32_t userId); 65 virtual int32_t OptimizeStorage(const std::string &bundleName, const int32_t userId, const int32_t agingDays); 66 virtual int32_t DownloadThumb(); 67 virtual int32_t CacheVideo(); 68 virtual int32_t CleanVideoCache(); 69 virtual int32_t CleanCache(const std::string &bundleName, const int32_t userId, const std::string &uri); 70 virtual int32_t DisableCloud(const int32_t userId); 71 virtual int32_t GetUserId(int32_t &userId); 72 virtual int32_t SaveSubscription(const std::string &bundleName, const int32_t userId); 73 virtual int32_t ReportEntry(const std::string &bundleName, const int32_t userId); 74 }; 75 } // namespace OHOS::FileManagement::CloudSync 76 77 #endif // OHOS_CLOUD_FILE_DATA_SYNC_MANAGER_H