1 /*
2  * Copyright (c) 2022 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 #include "object_callback_impl.h"
16 
17 namespace OHOS::ObjectStore {
Completed(const std::map<std::string,int32_t> & results)18 void ObjectSaveCallback::Completed(const std::map<std::string, int32_t> &results)
19 {
20     callback_(results);
21 }
22 
ObjectSaveCallback(const std::function<void (const std::map<std::string,int32_t> &)> & callback)23 ObjectSaveCallback::ObjectSaveCallback(const std::function<void(const std::map<std::string, int32_t> &)> &callback)
24     : callback_(callback)
25 {
26 }
27 
Completed(int32_t status)28 void ObjectRevokeSaveCallback::Completed(int32_t status)
29 {
30     callback_(status);
31 }
32 
ObjectRevokeSaveCallback(const std::function<void (int32_t)> & callback)33 ObjectRevokeSaveCallback::ObjectRevokeSaveCallback(const std::function<void(int32_t)> &callback) : callback_(callback)
34 {
35 }
36 
Completed(const std::map<std::string,std::vector<uint8_t>> & results,bool allReady)37 void ObjectRetrieveCallback::Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady)
38 {
39     callback_(results, allReady);
40 }
41 
ObjectRetrieveCallback(const std::function<void (const std::map<std::string,std::vector<uint8_t>> &,bool)> & callback)42 ObjectRetrieveCallback::ObjectRetrieveCallback(
43     const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> &callback)
44     : callback_(callback)
45 {
46 }
47 
Completed(const std::map<std::string,std::vector<uint8_t>> & results,bool allReady)48 void ObjectChangeCallback::Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady)
49 {
50     callback_(results, allReady);
51 }
52 
ObjectChangeCallback(const std::function<void (const std::map<std::string,std::vector<uint8_t>> &,bool)> & callback)53 ObjectChangeCallback::ObjectChangeCallback(
54     const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> &callback)
55     : callback_(callback)
56 {
57 }
58 } // namespace OHOS::DistributedKv
59