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