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 #define LOG_TAG "KvStoreObserverClient" 17 18 #include "kvstore_observer_client.h" 19 #include "log_print.h" 20 21 namespace OHOS { 22 namespace DistributedKv { KvStoreObserverClient(std::shared_ptr<KvStoreObserver> kvStoreObserver)23KvStoreObserverClient::KvStoreObserverClient(std::shared_ptr<KvStoreObserver> kvStoreObserver) 24 : kvStoreObserver_(kvStoreObserver) 25 { 26 ZLOGI("start"); 27 } 28 ~KvStoreObserverClient()29KvStoreObserverClient::~KvStoreObserverClient() 30 { 31 ZLOGI("end"); 32 } 33 OnChange(const ChangeNotification & changeNotification)34void KvStoreObserverClient::OnChange(const ChangeNotification &changeNotification) 35 { 36 ZLOGI("start"); 37 if (kvStoreObserver_ != nullptr) { 38 ZLOGI("SINGLE_VERSION start"); 39 kvStoreObserver_->OnChange(changeNotification); 40 } 41 } 42 OnChange(const DataOrigin & origin,IKvStoreObserver::Keys && keys)43void KvStoreObserverClient::OnChange(const DataOrigin &origin, IKvStoreObserver::Keys &&keys) 44 { 45 ZLOGI("start"); 46 if (kvStoreObserver_ != nullptr) { 47 kvStoreObserver_->OnChange(origin, std::move(keys)); 48 } 49 } 50 } // namespace DistributedKv 51 } // namespace OHOS 52