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