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
|
import "table.proto";
package drizzled.message;
option optimize_for = SPEED;
/*
Context for a transaction.
*/
message TransactionContext
{
required int32 server_id = 1;
required int64 transaction_id = 2;
}
/*
Insert one record into a single table.
*/
message InsertRecord
{
repeated Table.Field insert_field = 3;
repeated bytes insert_value = 4;
}
/*
Update one record in a single table.
*/
message UpdateRecord
{
repeated Table.Field update_field = 3;
repeated bytes before_value = 4;
repeated bytes after_value = 5;
repeated Table.Field where_field = 6;
repeated bytes where_value = 7;
}
/*
Deletes one record in a single table
*/
message DeleteRecord
{
repeated Table.Field where_field = 3;
repeated bytes where_value = 4;
}
/*
A component of a transaction -- a single instruction or command
*/
message Command
{
enum Type
{
START_TRANSACTION = 0; /* A START TRANSACTION statement */
COMMIT = 1; /* A COMMIT statement */
ROLLBACK = 2; /* A ROLLBACK statement */
INSERT = 3; /* An insert of a single record */
DELETE = 4; /* A delete of a single record */
UPDATE = 5; /* An update of a single record */
RAW_SQL = 6; /* A raw SQL statement */
}
required Type type = 1;
required uint64 timestamp = 2; /* A nanosecond precision timestamp */
/*
Transaction Context is duplicated here so that ChangeRecords may
be sent over the wire separately from the rest of the records in
a transaction.
*/
required TransactionContext transaction_context = 3;
optional string schema = 4; /* The schema affected */
optional string table = 5; /* The table affected */
optional string sql = 6; /* May contain the actual SQL supplied for the original statement */
/*
The below implement the actual change. Each ChangeRecord will
have zero or one of the below sub-messages defined.
*/
optional InsertRecord insert_record = 7;
optional DeleteRecord delete_record = 8;
optional UpdateRecord update_record = 9;
}
message Transaction
{
required TransactionContext transaction_context = 1;
required uint64 start_timestamp = 2;
required uint64 end_timestamp = 3;
repeated Command command = 4;
}
/*
* Describes a server used in replication. This message
* class is passed in the Publisher::registerSubscriber()
* and Subscriber::subscribe() methods.
*/
message Server
{
required int32 server_id = 1; /* A unique numeric identifier for this server */
required string ip_address = 2; /* A valid IP address */
required uint32 port = 3; /* Port that this server is listening for replication events */
optional string name = 4; /* Optional name for the server */
}
/*
* A subscriber manifest describes the state of
* a subscriber in replication. This message class
* is passed in the replication API in the
* drizzled::plugin::Publisher's dataIsAvailable() and
* pullData() calls.
*/
message SubscriberManifest
{
required int32 server_id = 1; /* Only need to pass the ID...not the whole Server message */
required uint64 last_applied_timestamp = 2; /* The timestamp of the last time this subscriber communicated with the publisher */
required int64 last_applied_transaction_id = 3; /* The timestamp of last applied transaction or command */
}
|