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