• 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 KVSTORE_OBSERVER_IMPL_H
17 #define KVSTORE_OBSERVER_IMPL_H
18 
19 #include "ikvstore.h"
20 #include "ikvstore_observer.h"
21 #include "kv_store_delegate.h"
22 #include "types.h"
23 
24 namespace OHOS {
25 namespace DistributedKv {
26 
27 class KvStoreObserverImpl : public DistributedDB::KvStoreObserver {
28 public:
29     KvStoreObserverImpl(SubscribeType subscribeType, sptr<IKvStoreObserver> observerProxy);
30 
31     virtual ~KvStoreObserverImpl();
32 
33     // Database change callback
34     void OnChange(const DistributedDB::KvStoreChangedData &data) override;
35 
36     SubscribeType GetSubscribeType() const;
37     sptr<IKvStoreObserver> GetKvStoreObserverProxy() const;
38 
39 private:
40     SubscribeType subscribeType_;
41     sptr<IKvStoreObserver> observerProxy_;
42 };
43 
44 }  // namespace DistributedKv
45 }  // namespace OHOS
46 
47 #endif  // KVSTORE_OBSERVER_IMPL_H
48