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 KVSTORE_APP_ACCESSOR_H 17 #define KVSTORE_APP_ACCESSOR_H 18 19 #include "kv_store_delegate_manager.h" 20 #include <mutex> 21 #include <set> 22 #include <string> 23 24 namespace OHOS::DistributedKv { 25 struct AppAccessorParam { 26 std::string userId; 27 std::string appId; 28 std::string storeId; 29 DistributedDB::AutoLaunchOption launchOption; 30 }; 31 32 class KvStoreAppAccessor { 33 public: 34 ~KvStoreAppAccessor(); 35 void EnableKvStoreAutoLaunch(const AppAccessorParam ¶m); 36 37 void DisableKvStoreAutoLaunch(const AppAccessorParam ¶m); 38 39 void EnableKvStoreAutoLaunch(); 40 41 void OnCallback(const std::string &userId, const std::string &appId, 42 const std::string &storeId, DistributedDB::AutoLaunchStatus status); 43 static KvStoreAppAccessor &GetInstance(); 44 45 private: 46 KvStoreAppAccessor(); 47 }; 48 } // namespace OHOS::DistributedKv 49 #endif // KVSTORE_APP_ACCESSOR_H 50