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 "single_ver_sync_target.h" 17 18 #include <string> 19 20 #include "db_errno.h" 21 #include "sync_operation.h" 22 #include "log_print.h" 23 24 namespace DistributedDB { SingleVerSyncTarget()25SingleVerSyncTarget::SingleVerSyncTarget() 26 : endWaterMark_(0) 27 { 28 } 29 ~SingleVerSyncTarget()30SingleVerSyncTarget::~SingleVerSyncTarget() 31 { 32 } 33 SetSyncOperation(SyncOperation * operation)34void SingleVerSyncTarget::SetSyncOperation(SyncOperation *operation) 35 { 36 SyncTarget::SetSyncOperation(operation); 37 if ((operation != nullptr) && !operation->IsKilled()) { 38 operation->GetQuery(query_); 39 isQuerySync_ = operation->IsQuerySync(); 40 } 41 } 42 SetEndWaterMark(WaterMark waterMark)43void SingleVerSyncTarget::SetEndWaterMark(WaterMark waterMark) 44 { 45 endWaterMark_ = waterMark; 46 } 47 GetEndWaterMark() const48WaterMark SingleVerSyncTarget::GetEndWaterMark() const 49 { 50 return endWaterMark_; 51 } 52 SetResponseSessionId(uint32_t responseSessionId)53void SingleVerSyncTarget::SetResponseSessionId(uint32_t responseSessionId) 54 { 55 responseSessionId_ = responseSessionId; 56 } 57 GetResponseSessionId() const58uint32_t SingleVerSyncTarget::GetResponseSessionId() const 59 { 60 return responseSessionId_; 61 } 62 SetQuery(const QuerySyncObject & query)63void SingleVerSyncTarget::SetQuery(const QuerySyncObject &query) 64 { 65 query_ = query; 66 } 67 GetQuery() const68QuerySyncObject SingleVerSyncTarget::GetQuery() const 69 { 70 return query_; 71 } 72 SetQuerySync(bool isQuerySync)73void SingleVerSyncTarget::SetQuerySync(bool isQuerySync) 74 { 75 isQuerySync_ = isQuerySync; 76 } 77 IsQuerySync() const78bool SingleVerSyncTarget::IsQuerySync() const 79 { 80 return isQuerySync_; 81 } 82 } // namespace DistributedDB