-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathpika_inner_message.proto
163 lines (142 loc) · 4.14 KB
/
pika_inner_message.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
syntax = "proto2";
package InnerMessage;
enum Type {
kMetaSync = 1;
kTrySync = 2;
kDBSync = 3;
kBinlogSync = 4;
kHeatBeat = 5;
kRemoveSlaveNode = 6;
}
enum StatusCode {
kOk = 1;
kError = 2;
kOther = 3;
}
message BinlogOffset {
required uint32 filenum = 1;
required uint64 offset = 2;
// consensus use
optional uint32 term = 3;
optional uint64 index = 4;
}
message Node {
required string ip = 1;
required int32 port = 2;
}
message Partition {
required string table_name = 1;
required uint32 partition_id = 2;
}
message TableInfo {
required string table_name = 1;
required uint32 partition_num = 2;
repeated uint32 partition_ids = 3;
}
message PikaMeta {
repeated TableInfo table_infos = 1;
}
message ConsensusMeta {
optional uint32 term = 1;
// Leader -> Follower prev_log_offset
// Follower -> Leader last_log_offset
optional BinlogOffset log_offset = 2;
optional BinlogOffset commit = 3;
optional bool reject = 4;
repeated BinlogOffset hint = 5;
}
// Request message
message InnerRequest {
// slave to master
message MetaSync {
required Node node = 1;
optional string auth = 2;
}
// slave to master
message TrySync {
required Node node = 1;
required Partition partition = 2;
required BinlogOffset binlog_offset = 3;
}
// slave to master
message DBSync {
required Node node = 1;
required Partition partition = 2;
required BinlogOffset binlog_offset = 3;
}
message BinlogSync {
required Node node = 1;
required string table_name = 2;
required uint32 partition_id = 3;
required BinlogOffset ack_range_start = 4;
required BinlogOffset ack_range_end = 5;
required int32 session_id = 6;
required bool first_send = 7;
}
message RemoveSlaveNode {
required Node node = 1;
required Partition partition = 2;
}
required Type type = 1;
optional MetaSync meta_sync = 2;
optional TrySync try_sync = 3;
optional DBSync db_sync = 4;
optional BinlogSync binlog_sync = 5;
repeated RemoveSlaveNode remove_slave_node = 6;
optional ConsensusMeta consensus_meta = 7;
}
message PartitionInfo {
required uint32 partition_id = 1;
required Node master = 2;
repeated Node slaves = 3;
}
// Response message
message InnerResponse {
// master to slave
message MetaSync {
message TableInfo {
required string table_name = 1;
required int32 partition_num = 2;
}
required bool classic_mode = 1;
repeated TableInfo tables_info = 2;
}
// master to slave
message TrySync {
enum ReplyCode {
kOk = 1;
kSyncPointBePurged = 2;
kSyncPointLarger = 3;
kError = 4;
}
required ReplyCode reply_code = 1;
required Partition partition = 2;
optional BinlogOffset binlog_offset = 3;
optional int32 session_id = 4;
}
message DBSync {
required Partition partition = 1;
required int32 session_id = 2;
}
// master to slave
message BinlogSync {
required Partition partition = 1;
required BinlogOffset binlog_offset = 2;
required bytes binlog = 3;
required int32 session_id = 4;
}
message RemoveSlaveNode {
required Node node = 1;
required Partition partition = 2;
}
required Type type = 1;
required StatusCode code = 2;
optional string reply = 3;
optional MetaSync meta_sync = 4;
optional DBSync db_sync = 5;
optional TrySync try_sync = 6;
repeated BinlogSync binlog_sync = 7;
repeated RemoveSlaveNode remove_slave_node = 8;
// consensus use
optional ConsensusMeta consensus_meta = 9;
}