/
volc.proto
148 lines (126 loc) · 2.95 KB
/
volc.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
syntax = "proto2";
option go_package="./;volc";
option optimize_for = SPEED;
package volc;
enum EntryType {
UNKNOWN_ENTRY = 0;
BEGIN = 1;
COMMIT = 2;
DML = 3;
DDL = 4;
}
enum SrcType {
UNKNOWN_SRC = 0;
MySQL = 1;
PostgreSQL = 2;
}
enum DMLType {
OTHER_DML = 0;
INSERT = 1;
UPDATE = 2;
DELETE = 3;
}
enum DDLType {
OTHER_DDL = 0;
CREATE_TABLE = 2;
ALTER_TABLE = 3;
DROP_TABLE = 4;
RENAME_TABLE = 5;
TRUNCATE_TABLE = 6;
CREATE_VIEW = 7;
ALTER_VIEW = 8;
DROP_VIEW = 9;
CREATE_INDEX = 10;
DROP_INDEX = 11;
CREATE_FUNCTION = 12;
DROP_FUNCTION = 13;
CREATE_PROCEDURE= 14;
DROP_PROCEDURE = 15;
}
enum ColumnType {
UNKNOWN = 0;
STRING = 1;
BINARY = 2;
INTEGER = 3; // store as int64 value
UNSIGNED_INTEGER = 4; // store as uint64 value
FLOAT = 5; // store as float value
DECIMAL = 6; // store as string value
BOOL = 7;
DATETIME = 8; //store in string value in RFC3339Nano format
}
message Entry {
optional int32 version = 1;
repeated Prop props = 2;
optional SrcType src_type = 3;
optional EntryType entry_type = 4;
optional int64 timestamp = 5;
optional string server_id = 6;
optional string database = 7;
optional string table = 8;
oneof event {
DMLEvent dml_event = 21;
DDLEvent ddl_event = 22;
CommitEvent commit_event = 23;
BeginEvent begin_event = 24;
}
}
message Prop{
optional string key = 1;
optional string value = 2;
}
message BeginEvent {
optional string transaction_id = 1;
optional string file = 2;
optional string offset = 3;
repeated Prop props = 4;
}
message CommitEvent {
optional string transaction_id = 1;
optional string file = 2;
optional string offset = 3;
repeated Prop props = 4;
}
message DDLEvent {
optional string sql = 1;
optional int64 exec_time = 2; // unit: second
optional int32 err_code = 3;
repeated Prop props = 4;
optional DDLType type = 5;
}
message DMLEvent {
optional DMLType type = 1;
optional string table_id = 2;
optional Index use_index = 3;
repeated ColumnDef column_defs= 4;
repeated Row rows = 5;
repeated Prop props = 6;
}
message Index {
optional string name = 1;
repeated int32 column_index = 2;
}
message Row {
repeated Column before_cols = 1;
repeated Column after_cols = 2;
}
message ColumnDef {
repeated Prop props = 1;
optional int32 index = 2;
optional ColumnType type = 3;
optional string origin_type = 4;
optional string name = 5;
optional string charset = 6;
optional bool is_nullable = 7;
optional bool is_unsigned = 8;
}
message Column {
optional bool is_null = 1;
oneof value {
string string_value = 2;
bytes binary_value = 3;
double float_value = 4;
int64 int64_value = 5;
uint64 uint64_value = 6;
bool bool_value = 7;
}
}