1 /* 2 * Copyright (c) 2023-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_FILEMGMT_BACKUP_STORAGE_MGR_ADAPTER_H 17 #define OHOS_FILEMGMT_BACKUP_STORAGE_MGR_ADAPTER_H 18 19 #include <string> 20 #include <vector> 21 #include <unistd.h> 22 23 #include "istorage_manager.h" 24 25 namespace OHOS::FileManagement::Backup { 26 class StorageMgrAdapter { 27 public: 28 /** 29 * @brief Get the bundle stats object 30 * 31 * @param bundleName bundle name 32 */ 33 static StorageManager::BundleStats GetBundleStats(const std::string &bundleName); 34 35 /** 36 * @brief Get the user storage stats object 37 * 38 * @param bundleName bundle name 39 * @param userId user id 40 */ 41 static int64_t GetUserStorageStats(const std::string &bundleName, int32_t userId); 42 43 /** 44 * @brief update memory para 45 * 46 * @param size para data 47 */ 48 static int32_t UpdateMemPara(int32_t size); 49 50 /** 51 * @brief Get the user storage stats object 52 * 53 * @param userId user id 54 * @param bundleNames 55 * @param incrementalBackTimes 56 * @param pkgFileSizes bundle backup file size 57 * @param incPkgFileSizes Incremental bundle backup file size 58 */ 59 static int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames, 60 const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes, 61 std::vector<int64_t> &incPkgFileSizes); 62 }; 63 } // namespace OHOS::FileManagement::Backup 64 #endif // OHOS_FILEMGMT_BACKUP_STORAGE_MGR_ADAPTER_H