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 #include "kvdb_commit_notify_filterable_data.h" 17 #include "db_errno.h" 18 19 namespace DistributedDB { KvDBCommitNotifyFilterAbleData()20KvDBCommitNotifyFilterAbleData::KvDBCommitNotifyFilterAbleData() 21 : genericKvDB_(nullptr), 22 notifyID_(0) 23 {} 24 ~KvDBCommitNotifyFilterAbleData()25KvDBCommitNotifyFilterAbleData::~KvDBCommitNotifyFilterAbleData() 26 { 27 if (genericKvDB_ != nullptr) { 28 genericKvDB_->DecObjRef(genericKvDB_); 29 genericKvDB_ = nullptr; 30 } 31 } 32 GetInsertedEntries(int & errCode) const33const std::list<Entry> KvDBCommitNotifyFilterAbleData::GetInsertedEntries(int &errCode) const 34 { 35 std::list<Entry> entries; 36 errCode = E_OK; 37 return entries; 38 } 39 GetUpdatedEntries(int & errCode) const40const std::list<Entry> KvDBCommitNotifyFilterAbleData::GetUpdatedEntries(int &errCode) const 41 { 42 std::list<Entry> entries; 43 errCode = E_OK; 44 return entries; 45 } 46 GetDeletedEntries(int & errCode) const47const std::list<Entry> KvDBCommitNotifyFilterAbleData::GetDeletedEntries(int &errCode) const 48 { 49 std::list<Entry> entries; 50 errCode = E_OK; 51 return entries; 52 } 53 GetCommitConflicts(int & errCode) const54const std::list<KvDBConflictEntry> KvDBCommitNotifyFilterAbleData::GetCommitConflicts(int &errCode) const 55 { 56 std::list<KvDBConflictEntry> entries; 57 errCode = E_OK; 58 return entries; 59 } 60 IsCleared() const61bool KvDBCommitNotifyFilterAbleData::IsCleared() const 62 { 63 return false; 64 } 65 IsChangedDataEmpty() const66bool KvDBCommitNotifyFilterAbleData::IsChangedDataEmpty() const 67 { 68 return true; 69 } 70 IsConflictedDataEmpty() const71bool KvDBCommitNotifyFilterAbleData::IsConflictedDataEmpty() const 72 { 73 return true; 74 } 75 SetFilterKey(const Key & key)76void KvDBCommitNotifyFilterAbleData::SetFilterKey(const Key &key) 77 { 78 (void)key; 79 } 80 SetMyDb(GenericKvDB * db,uint64_t notifyID)81void KvDBCommitNotifyFilterAbleData::SetMyDb(GenericKvDB *db, uint64_t notifyID) 82 { 83 if (genericKvDB_ == db) { 84 notifyID_ = notifyID; 85 return; 86 } 87 if (genericKvDB_ != nullptr) { 88 genericKvDB_->DecObjRef(genericKvDB_); 89 } 90 genericKvDB_ = db; 91 if (genericKvDB_ != nullptr) { 92 genericKvDB_->IncObjRef(genericKvDB_); 93 } 94 notifyID_ = notifyID; 95 } 96 GetNotifyID() const97uint64_t KvDBCommitNotifyFilterAbleData::GetNotifyID() const 98 { 99 return notifyID_; 100 } 101 102 DEFINE_OBJECT_TAG_FACILITIES(KvDBCommitNotifyFilterAbleData) 103 } 104