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 #ifndef DELEGATE_KV_MGR_CALLBACK_H 16 #define DELEGATE_KV_MGR_CALLBACK_H 17 18 #include "kv_store_delegate.h" 19 20 // DelegateKvMgrCallback conclude the Callback implements of function< void(DBStatus, KvStoreDelegate*)> 21 class DelegateKvMgrCallback { 22 public: DelegateKvMgrCallback()23 DelegateKvMgrCallback() {} ~DelegateKvMgrCallback()24 ~DelegateKvMgrCallback() {} 25 26 // Delete the copy and assign constructors 27 DelegateKvMgrCallback(const DelegateKvMgrCallback &callback) = delete; 28 DelegateKvMgrCallback& operator=(const DelegateKvMgrCallback &callback) = delete; 29 DelegateKvMgrCallback(DelegateKvMgrCallback &&callback) = delete; 30 DelegateKvMgrCallback& operator=(DelegateKvMgrCallback &&callback) = delete; 31 32 void Callback(DistributedDB::DBStatus status, DistributedDB::KvStoreDelegate *kvStoreDelegate); 33 34 DistributedDB::DBStatus GetStatus(); 35 36 const DistributedDB::KvStoreDelegate *GetKvStore(); 37 38 private: 39 DistributedDB::DBStatus status_ = DistributedDB::DBStatus::INVALID_ARGS; 40 DistributedDB::KvStoreDelegate *kvStoreDelegate_ = nullptr; 41 }; 42 43 #endif // DELEGATE_KV_MGR_CALLBACK_H