• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
17 #define OHOS_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
18 
19 #include <map>
20 
21 #include "iremote_broker.h"
22 
23 #include "cloud_sync_common.h"
24 
25 namespace OHOS::FileManagement::CloudSync {
26 class ICloudSyncService : public IRemoteBroker {
27 public:
28     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Filemanagement.Dfs.ICloudSyncService")
29 
30     virtual int32_t UnRegisterCallbackInner(const std::string &bundleName = "") = 0;
31     virtual int32_t UnRegisterFileSyncCallbackInner(const std::string &bundleName = "") = 0;
32     virtual int32_t RegisterCallbackInner(const sptr<IRemoteObject> &remoteObject,
33                                           const std::string &bundleName = "") = 0;
34     virtual int32_t RegisterFileSyncCallbackInner(const sptr<IRemoteObject> &remoteObject,
35                                           const std::string &bundleName = "") = 0;
36     virtual int32_t StartSyncInner(bool forceFlag, const std::string &bundleName = "") = 0;
37     virtual int32_t StartFileSyncInner(bool forceFlag, const std::string &bundleName = "") = 0;
38     virtual int32_t TriggerSyncInner(const std::string &bundleName, const int32_t &userId) = 0;
39     virtual int32_t StopSyncInner(const std::string &bundleName = "", bool forceFlag = false) = 0;
40     virtual int32_t StopFileSyncInner(const std::string &bundleName = "", bool forceFlag = false) = 0;
41     virtual int32_t ResetCursor(const std::string &bundleName = "") = 0;
42     virtual int32_t ChangeAppSwitch(const std::string &accoutId, const std::string &bundleName, bool status) = 0;
43     virtual int32_t OptimizeStorage(const OptimizeSpaceOptions &optimizeOptions, bool isCallbackValid = false,
44         const sptr<IRemoteObject> &optimizeCallback = nullptr) = 0;
45     virtual int32_t StopOptimizeStorage() = 0;
46     virtual int32_t Clean(const std::string &accountId, const CleanOptions &cleanOptions) = 0;
47     virtual int32_t NotifyDataChange(const std::string &accoutId, const std::string &bundleName) = 0;
48     virtual int32_t NotifyEventChange(int32_t userId, const std::string &eventId, const std::string &extraData) = 0;
49     virtual int32_t EnableCloud(const std::string &accoutId, const SwitchDataObj &switchData) = 0;
50     virtual int32_t DisableCloud(const std::string &accoutId) = 0;
51     virtual int32_t StartDownloadFile(const std::string &path) = 0;
52     virtual int32_t StartFileCache(const std::vector<std::string> &pathVec,
53                                    int64_t &downloadId,
54                                    std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT,
55                                    bool isCallbackValid = false,
56                                    const sptr<IRemoteObject> &downloadCallback = nullptr,
57                                    int32_t timeout = -1) = 0;
58     virtual int32_t StopDownloadFile(const std::string &path, bool needClean = false) = 0;
59     virtual int32_t StopFileCache(int64_t downloadId, bool needClean = false, int32_t timeout = -1) = 0;
60     virtual int32_t DownloadThumb() = 0;
61     virtual int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback) = 0;
62     virtual int32_t RegisterFileCacheCallback(const sptr<IRemoteObject> &downloadCallback) = 0;
63     virtual int32_t UnregisterDownloadFileCallback() = 0;
64     virtual int32_t UnregisterFileCacheCallback() = 0;
65     virtual int32_t UploadAsset(const int32_t userId, const std::string &request, std::string &result) = 0;
66     virtual int32_t DownloadFile(const int32_t userId, const std::string &bundleName, AssetInfoObj &assetInfoObj) = 0;
67     virtual int32_t DownloadFiles(const int32_t userId,
68                                   const std::string &bundleName,
69                                   const std::vector<AssetInfoObj> &assetInfoObj,
70                                   std::vector<bool> &assetResultMap) = 0;
71     virtual int32_t DownloadAsset(const uint64_t taskId,
72                                   const int32_t userId,
73                                   const std::string &bundleName,
74                                   const std::string &networkId,
75                                   AssetInfoObj &assetInfoObj) = 0;
76     virtual int32_t RegisterDownloadAssetCallback(const sptr<IRemoteObject> &remoteObject) = 0;
77     virtual int32_t DeleteAsset(const int32_t userId, const std::string &uri) = 0;
78     virtual int32_t GetSyncTimeInner(int64_t &syncTime, const std::string &bundleName = "") = 0;
79     virtual int32_t CleanCacheInner(const std::string &uri) = 0;
80     virtual int32_t BatchCleanFile(const std::vector<CleanFileInfoObj> &fileInfo,
81         std::vector<std::string> &failCloudId) = 0;
82     virtual int32_t BatchDentryFileInsert(const std::vector<DentryFileInfoObj> &fileInfo,
83         std::vector<std::string> &failCloudId) = 0;
84 };
85 } // namespace OHOS::FileManagement::CloudSync
86 
87 #endif // OHOS_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
88