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