~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/transaction.proto

  • Committer: Brian Aker
  • Date: 2009-04-13 16:22:40 UTC
  • mfrom: (971.1.78 mordred)
  • Revision ID: brian@gaz-20090413162240-ugi3gvhofmcuglzl
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package drizzle;
 
1
import "table.proto";
 
2
 
 
3
package drizzled.message;
2
4
option optimize_for = SPEED;
3
5
 
4
 
message Event {
5
 
  enum Type {
6
 
    DDL = 0;
7
 
    INSERT = 1;
8
 
    DELETE = 2;
9
 
    UPDATE = 3;
10
 
    COMMIT = 4;
11
 
  }
12
 
 
13
 
  message Value {
14
 
    repeated string val = 1;
15
 
  }
16
 
 
 
6
/*
 
7
  Context for a transaction.
 
8
*/
 
9
message TransactionContext
 
10
{
 
11
  required int32 server_id = 1;
 
12
  required int64 transaction_id = 2;
 
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 string 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 string before_value = 4;
 
31
  repeated string after_value = 5;
 
32
  repeated Table.Field where_field = 6;
 
33
  repeated string 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 string 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
  }
17
60
  required Type type = 1;
18
 
  required bool autocommit = 2;
19
 
  required string server_id = 3;
20
 
  required uint64 query_id = 4;
21
 
  required string transaction_id = 5;
22
 
  required string schema = 6;
23
 
  optional string table = 7;
24
 
  repeated string field_names = 8;
25
 
  optional string primary_key = 9;
26
 
  repeated Value values = 10;
27
 
  optional string sql = 11;
 
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;
28
80
}
29
81
 
30
 
message EventList {
31
 
  repeated Event event = 1;
 
82
message Transaction
 
83
{
 
84
  required TransactionContext transaction_context = 1;
 
85
  required uint64 start_timestamp = 2;
 
86
  required uint64 end_timestamp = 3;
 
87
  repeated Command command = 4;
32
88
}