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