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 SINGLE_VER_SYNC_TARGET_H 17 #define SINGLE_VER_SYNC_TARGET_H 18 19 #include <cstdint> 20 #include "db_types.h" 21 #include "query_sync_object.h" 22 #include "sync_target.h" 23 24 namespace DistributedDB { 25 class SingleVerSyncTarget final : public SyncTarget { 26 public: 27 SingleVerSyncTarget(); 28 ~SingleVerSyncTarget() override; 29 30 // Set a syncOperation 31 void SetSyncOperation(SyncOperation *operation) override; 32 33 // Set the end water mark of this task 34 void SetEndWaterMark(WaterMark waterMark); 35 36 // Get the end water mark of this task 37 WaterMark GetEndWaterMark() const; 38 39 // For pull response sync 40 void SetResponseSessionId(uint32_t responseSessionId); 41 uint32_t GetResponseSessionId() const override; 42 43 // For query sync 44 void SetQuery(const QuerySyncObject &query); 45 QuerySyncObject GetQuery() const; 46 void SetQuerySync(bool isQuerySync); 47 bool IsQuerySync() const; 48 private: 49 WaterMark endWaterMark_; 50 uint32_t responseSessionId_ = 0; 51 QuerySyncObject query_; 52 bool isQuerySync_ = false; 53 }; 54 } // namespace DistributedDB 55 56 #endif // SINGLE_VER_SYNC_TARGET_H 57