• 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, InnerBundleInfo> &infos) = 0;
35     /**
36      * @brief Save the bundle data corresponding to the device Id of the bundle name to KvStore.
37      * @param innerBundleInfo Indicates the InnerBundleInfo object to be save.
38      * @return Returns true if this function is successfully called; returns false otherwise.
39      */
40     virtual bool SaveStorageBundleInfo(const InnerBundleInfo &innerBundleInfo) = 0;
41 
42     /**
43      * @brief Save the bundle data corresponding to the device Id of the bundle name to KvStore.
44      * @param innerBundleInfo Indicates the InnerBundleInfo object to be save.
45      * @return Returns true if this function is successfully called; returns false otherwise.
46      */
47     virtual ErrCode SaveStorageBundleInfoWithCode(const InnerBundleInfo &innerBundleInfo) = 0;
48     /**
49      * @brief Delete the bundle data corresponding to the device Id of the bundle name to KvStore.
50      * @param innerBundleInfo Indicates the InnerBundleInfo object to be Delete.
51      * @return Returns true if this function is successfully called; returns false otherwise.
52      */
53     virtual bool DeleteStorageBundleInfo(const InnerBundleInfo &innerBundleInfo) = 0;
54 
55     virtual bool ResetKvStore() = 0;
56 };
57 }  // namespace AppExecFwk
58 }  // namespace OHOS
59 #endif  // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IBUNDLE_DATA_STORAGE_H
60