• 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 I_KVSTORE_SYNC_CALLBACK_H
17 #define I_KVSTORE_SYNC_CALLBACK_H
18 
19 #include <map>
20 #include "iremote_broker.h"
21 #include "iremote_proxy.h"
22 #include "iremote_stub.h"
23 #include "types.h"
24 #include "visibility.h"
25 
26 namespace OHOS {
27 namespace DistributedKv {
28 class IKvStoreSyncCallback : public IRemoteBroker {
29 public:
30     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedKv.IKvStoreSyncCallback");
31     virtual void SyncCompleted(const std::map<std::string, Status> &results, uint64_t sequenceId) = 0;
32 };
33 
34 class KvStoreSyncCallbackStub : public IRemoteStub<IKvStoreSyncCallback> {
35 public:
36     int OnRemoteRequest(uint32_t code, MessageParcel &data,
37                         MessageParcel &reply, MessageOption &option) override;
38 };
39 
40 class API_EXPORT KvStoreSyncCallbackProxy : public IRemoteProxy<IKvStoreSyncCallback> {
41 public:
42     explicit KvStoreSyncCallbackProxy(const sptr<IRemoteObject> &impl);
43     ~KvStoreSyncCallbackProxy() = default;
44     void SyncCompleted(const std::map<std::string, Status> &results, uint64_t sequenceId) override;
45 private:
46     static inline BrokerDelegator<KvStoreSyncCallbackProxy> delegator_;
47 };
48 }  // namespace DistributedKv
49 }  // namespace OHOS
50 
51 #endif  // I_KVSTORE_SYNC_CALLBACK_H
52