• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef OHOS_CLOUD_FILE_CLOUD_FILE_KIT_IMPL_H
17 #define OHOS_CLOUD_FILE_CLOUD_FILE_KIT_IMPL_H
18 
19 #include "cloud_file_kit.h"
20 #include <mutex>
21 
22 namespace OHOS::FileManagement::CloudFile {
23 class CloudFileKitImpl final : public CloudFileKit {
24 public:
25     int32_t GetCloudUserInfo(const int32_t userId, CloudUserInfo &userInfo) override;
26     std::pair<uint64_t, uint64_t> GetSpaceInfo(const int32_t userId, const std::string& bundleName) override;
27     int32_t GetAppSwitchStatus(const std::string &bundleName, const int32_t userId, bool &switchStatus) override;
28     int32_t ResolveNotificationEvent(const int32_t userId,
29                                      const std::string &extraData,
30                                      std::string &appBundleName,
31                                      std::string &prepareTraceId) override;
32 
33     std::shared_ptr<DataSyncManager> GetDataSyncManager() override;
34     std::shared_ptr<CloudAssetsDownloader> GetCloudAssetsDownloader(const int32_t userId,
35                                                                     const std::string &bundleName) override;
36     std::shared_ptr<CloudDatabase> GetCloudDatabase(const int32_t userId, const std::string &bundleName) override;
37     std::shared_ptr<CloudSyncHelper> GetCloudSyncHelper(const int32_t userId, const std::string &bundleName) override;
38     std::string GetPrepareTraceId(const int32_t userId) override;
39 
40 private:
41     std::mutex dataSyncManagerMutex_;
42     std::shared_ptr<DataSyncManager> dataSyncManager_;
43 
44     std::mutex cloudAssetsDownloaderMutex_;
45     std::shared_ptr<CloudAssetsDownloader> cloudAssetsDownloader_;
46 
47     std::mutex cloudSyncHelperMutex_;
48     std::shared_ptr<CloudSyncHelper> cloudSyncHelper_;
49 
50     std::mutex cloudDatabaseMutex_;
51     std::shared_ptr<CloudDatabase> cloudDatabase_;
52 };
53 } // namespace OHOS::FileManagement::CloudFile
54 
55 #endif // OHOS_CLOUD_FILE_CLOUD_FILE_KIT_IMPL_H