~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/replication.proto

Merged in latest plugin-slot-reorg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import "table.proto";
 
2
 
 
3
package drizzled.message;
 
4
option optimize_for = SPEED;
 
5
 
 
6
/*
 
7
  Context for a transaction.
 
8
*/
 
9
message TransactionContext
 
10
{
 
11
  required int32 server_id = 1;
 
12
  required uint64 transaction_id = 2; /* Globally-unique transaction ID */
 
13
}
 
14
 
 
15
/*
 
16
  Insert one record into a single table.
 
17
*/
 
18
message InsertRecord
 
19
{
 
20
  repeated Table.Field insert_field = 3;
 
21
  repeated bytes insert_value = 4;
 
22
}
 
23
 
 
24
/*
 
25
  Update one record in a single table.
 
26
*/
 
27
message UpdateRecord
 
28
{
 
29
  repeated Table.Field update_field = 3;
 
30
  repeated bytes before_value = 4;
 
31
  repeated bytes after_value = 5;
 
32
  repeated Table.Field where_field = 6;
 
33
  repeated bytes where_value = 7;
 
34
}
 
35
 
 
36
/*
 
37
  Deletes one record in a single table
 
38
*/
 
39
message DeleteRecord
 
40
{
 
41
  repeated Table.Field where_field = 3;
 
42
  repeated bytes where_value = 4;
 
43
}
 
44
 
 
45
/*
 
46
  A component of a transaction -- a single instruction or command
 
47
*/
 
48
message Command
 
49
{
 
50
  enum Type 
 
51
  {
 
52
    START_TRANSACTION = 0;        /* A START TRANSACTION statement */
 
53
    COMMIT = 1;                   /* A COMMIT statement */
 
54
    ROLLBACK = 2;                 /* A ROLLBACK statement */
 
55
    INSERT = 3;                   /* An insert of a single record */
 
56
    DELETE = 4;                   /* A delete of a single record */
 
57
    UPDATE = 5;                   /* An update of a single record */
 
58
    RAW_SQL = 6;                  /* A raw SQL statement */
 
59
  }
 
60
  required Type type = 1;
 
61
  required uint64 timestamp = 2;  /* A nanosecond precision timestamp */
 
62
  /* 
 
63
    Transaction Context is duplicated here so that ChangeRecords may
 
64
    be sent over the wire separately from the rest of the records in
 
65
    a transaction.
 
66
  */
 
67
  required TransactionContext transaction_context = 3;
 
68
  optional string schema = 4;     /* The schema affected */
 
69
  optional string table = 5;      /* The table affected */
 
70
 
 
71
  optional string sql = 6;  /* May contain the actual SQL supplied for the original statement */
 
72
 
 
73
  /* 
 
74
    The below implement the actual change.  Each ChangeRecord will 
 
75
    have zero or one of the below sub-messages defined. 
 
76
  */
 
77
  optional InsertRecord      insert_record = 7;
 
78
  optional DeleteRecord      delete_record = 8;
 
79
  optional UpdateRecord      update_record = 9;
 
80
 
 
81
  optional uint32 session_id = 30; /* Optionally stores the ID of the session which executed this command */
 
82
}
 
83
 
 
84
message Transaction
 
85
{
 
86
  required TransactionContext transaction_context = 1;
 
87
  required uint64 start_timestamp = 2;
 
88
  required uint64 end_timestamp = 3;
 
89
  repeated Command command = 4;
 
90
}
 
91
 
 
92
/*
 
93
 * Describes a server used in replication.  This message
 
94
 * class is passed in the Publisher::registerSubscriber()
 
95
 * and Subscriber::subscribe() methods.
 
96
 */
 
97
message Server
 
98
{
 
99
  /* A unique numeric identifier for this server */
 
100
  required int32 server_id = 1;
 
101
  /* A valid IP address */
 
102
  required string ip_address = 2;
 
103
  /* Port that this server is listening for replication events */
 
104
  required uint32 port = 3;
 
105
  /* Optional name for the server */
 
106
  optional string name = 4;
 
107
}
 
108
 
 
109
/*
 
110
 * A subscriber manifest describes the state of
 
111
 * a subscriber in replication.  This message class
 
112
 * is passed in the replication API in the 
 
113
 * drizzled::plugin::Publisher's findSubscriptionState() call
 
114
 */
 
115
message SubscriberManifest
 
116
{
 
117
  /* Only need to pass the ID...not the whole Server message */
 
118
  required int32 server_id = 1;
 
119
  /* 
 
120
   * The timestamp of the last time this subscriber 
 
121
   * communicated with the publisher 
 
122
   */
 
123
  required uint64 last_applied_timestamp = 2;
 
124
  /* The globally unique transaction ID of last applied command */ 
 
125
  required uint64 last_applied_transaction_id = 3;
 
126
}