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