• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SYNC_TARGET_H
17 #define SYNC_TARGET_H
18 
19 #include <cstdint>
20 #include "isync_target.h"
21 
22 namespace DistributedDB {
23 class SyncTarget : public ISyncTarget {
24 public:
SyncTarget()25     SyncTarget() : operation_(nullptr), taskType_(0), mode_(0) {};
26     ~SyncTarget() override;
27 
28     // Get the Sync Id of this task
29     int GetSyncId() const override;
30 
31     // Set the type of this task request or response
32     void SetTaskType(int taskType) override;
33 
34     // Get the type of this task request or response
35     int GetTaskType() const override;
36 
37     // Set the mode of this task request or response
38     void SetMode(int mode) override;
39 
40     // Get the mode of this task request or response
41     int GetMode() const override;
42 
43     // Set a SyncOperation
44     void SetSyncOperation(SyncOperation *operation) override;
45 
46     // Get a SyncOperation
47     void GetSyncOperation(SyncOperation *&operation) const override;
48 
49     // Is this target is an auto sync
50     bool IsAutoSync() const override;
51 
52     uint32_t GetResponseSessionId() const override;
53 
54 protected:
55     SyncOperation *operation_;
56     int taskType_; // sync task or response task;
57     int mode_;
58 };
59 } // namespace DistributedDB
60 
61 #endif // SYNC_TARGET_H
62