1 /* 2 * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_DATA_STORAGE_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_DATA_STORAGE_H 18 19 #include <map> 20 21 #include "bundle_data_storage_interface.h" 22 #include "inner_bundle_info.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 class BundleDataStorage : public IBundleDataStorage { 27 public: 28 /** 29 * @brief Load all installed bundles data from KvStore to innerBundleInfos. 30 * @param infos Indicates the map to save all installed bundles. 31 * @return Returns true if the data is successfully loaded; returns false otherwise. 32 */ 33 virtual bool LoadAllData(std::map<std::string, InnerBundleInfo> &infos); 34 /** 35 * @brief Save the bundle data corresponding to the device Id of the bundle name to KvStore. 36 * @param innerBundleInfo Indicates the InnerBundleInfo object to be save. 37 * @return Returns true if the data is successfully saved; returns false otherwise. 38 */ 39 virtual bool SaveStorageBundleInfo(const InnerBundleInfo &innerBundleInfo); 40 /** 41 * @brief Delete the bundle data corresponding to the device Id of the bundle name to KvStore. 42 * @param innerBundleInfo Indicates the InnerBundleInfo object to be Delete. 43 * @return Returns true if the data is successfully deleted; returns false otherwise. 44 */ 45 virtual bool DeleteStorageBundleInfo(const InnerBundleInfo &innerBundleInfo); 46 ResetKvStore()47 virtual bool ResetKvStore() 48 { 49 return true; 50 } 51 }; 52 } // namespace AppExecFwk 53 } // namespace OHOS 54 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_DATA_STORAGE_H 55