~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/table.proto

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Message format for tables.
 
3
*/
1
4
package drizzled.message;
2
5
option optimize_for = SPEED;
3
6
 
 
7
option java_package = "org.drizzle.messages";
 
8
option java_outer_classname = "TableMessage";
 
9
 
 
10
import "engine.proto";
 
11
 
4
12
message Table {
5
13
 
6
14
  enum TableType {
10
18
    FUNCTION = 3;
11
19
  }
12
20
 
13
 
  message StorageEngine {
14
 
 
15
 
    message EngineOption {
16
 
      enum EngineOptionType {
17
 
        BOOL = 0;
18
 
        INTEGER = 1;
19
 
        STRING = 2;
20
 
      }
21
 
 
22
 
      required string option_name = 1;
23
 
      required string option_value = 2;
24
 
      required EngineOptionType option_type = 3;
25
 
    }
26
 
 
27
 
    required string name = 1;
28
 
    repeated EngineOption option = 2;
29
 
  }
30
 
 
31
21
  message TableOptions {
32
 
    optional uint64 auto_increment = 1;
 
22
    optional bool has_user_set_auto_increment_value = 1;
33
23
    optional string collation = 2;
34
24
    optional uint32 collation_id = 3;
35
25
    optional string data_file_name = 5;
38
28
    optional uint64 min_rows = 8;
39
29
    optional uint64 auto_increment_value = 9;
40
30
    optional uint32 avg_row_length = 11;
41
 
    optional uint32 key_block_size = 12;
42
31
    optional uint32 block_size = 13;
43
32
    optional string comment = 14;
44
 
    optional bool pack_keys = 15;
45
33
    optional bool pack_record = 16;
46
34
    optional bool checksum = 17;
47
35
    optional bool page_checksum = 18;
48
36
    optional bool delay_key_write = 19;
49
 
 
50
 
    enum RowType {
51
 
         ROW_TYPE_DEFAULT = 0;
52
 
         ROW_TYPE_FIXED = 1;
53
 
         ROW_TYPE_DYNAMIC = 2;
54
 
         ROW_TYPE_COMPRESSED = 3;
55
 
         ROW_TYPE_REDUNDANT = 4;
56
 
         ROW_TYPE_COMPACT = 5;
57
 
         ROW_TYPE_PAGE = 6;
58
 
    }
59
 
 
60
 
    optional RowType row_type = 20;
61
 
  }
62
 
 
63
 
  message TableStats {
64
 
    optional uint32 avg_row_length = 1;
65
 
    optional uint64 max_rows = 2;
66
 
    optional uint32 min_rows = 3;
67
37
  }
68
38
 
69
39
  message ForeignKeyConstraint {
70
 
    required string name = 1;
71
 
    required Field dependent = 2;
72
 
    required Field parent = 3;
73
 
    /** @TODO Finish this off... */
 
40
    optional string name = 1;
 
41
    repeated string column_names = 2;
 
42
    required string references_table_name = 3;
 
43
    repeated string references_columns = 4;
 
44
 
 
45
    enum ForeignKeyMatchOption {
 
46
      MATCH_UNDEFINED = 0;
 
47
      MATCH_FULL = 1;
 
48
      MATCH_PARTIAL = 2;
 
49
      MATCH_SIMPLE = 3;
 
50
    }
 
51
    required ForeignKeyMatchOption match = 5;
 
52
 
 
53
    enum ForeignKeyOption {
 
54
      OPTION_UNDEF = 0;
 
55
      OPTION_RESTRICT = 1;
 
56
      OPTION_CASCADE = 2;
 
57
      OPTION_SET_NULL = 3;
 
58
      OPTION_NO_ACTION = 4;
 
59
      OPTION_SET_DEFAULT = 5;
 
60
    }
 
61
 
 
62
    required ForeignKeyOption update_option = 6 [ default = OPTION_UNDEF ];
 
63
    required ForeignKeyOption delete_option = 7 [ default = OPTION_UNDEF ];
74
64
  }
75
65
 
76
66
  message Field {
84
74
      BIGINT = 5;
85
75
      DECIMAL = 6;
86
76
      DATE = 7;
87
 
      TIMESTAMP = 9;
 
77
      EPOCH = 9;
88
78
      DATETIME = 10;
89
 
    }
90
 
 
91
 
    enum FieldFormatType {
92
 
      DefaultFormat= 0;
93
 
      FixedFormat= 1;
94
 
      DynamicFormat= 2;
 
79
      UUID = 11;
 
80
      TIME = 12;
 
81
      BOOLEAN = 13;
95
82
    }
96
83
 
97
84
    message FieldOptions {
99
86
      optional string update_value = 2;
100
87
      optional bool default_null = 3 [default = false];
101
88
      optional bytes default_bin_value = 4;
102
 
    }
103
 
 
104
 
    message TimestampFieldOptions {
105
 
      optional bool auto_updates = 1 [default = false];
 
89
      optional string default_expression = 5;
 
90
      optional string update_expression = 6;
106
91
    }
107
92
 
108
93
    message FieldConstraints {
109
 
      required bool is_nullable = 1 [default = true];
 
94
      optional bool is_nullable = 1 [default = true]; // Dead option, do not use
110
95
      optional bool is_unsigned = 2 [default = false];
 
96
      optional bool is_notnull = 3 [default = false];
 
97
      optional bool is_unique = 4 [default = false];
111
98
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
112
99
    }
113
100
 
130
117
      repeated string field_value = 4;
131
118
    }
132
119
 
 
120
    /*
 
121
      Do we store microseconds or timezone.
 
122
    */
 
123
    message TimeFieldOptions {
 
124
      optional bool microseconds = 1;
 
125
    }
 
126
 
133
127
    required string name = 1;
134
128
    required FieldType type = 2;
135
 
    optional FieldFormatType format = 3;
136
129
    optional FieldOptions options = 4;
137
130
    optional FieldConstraints constraints = 5;
138
131
    optional NumericFieldOptions numeric_options = 6;
139
132
    optional StringFieldOptions string_options = 7;
 
133
    optional TimeFieldOptions time_options = 8;
140
134
 
141
135
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
142
136
    optional EnumerationValues enumeration_values = 17;
143
 
    optional TimestampFieldOptions timestamp_options = 18;
144
137
  }
145
138
 
146
139
  message Index {
147
140
 
148
141
    enum IndexType {
149
 
    /* Kept in sync with enum ha_key_alg if only for stewart's sanity. */
 
142
    /* Kept in sync with enum ha_key_alg if only for stewart sanity. */
150
143
      UNKNOWN_INDEX = 0;
151
144
      BTREE = 1;
152
145
      RTREE = 2;
158
151
      required uint32 fieldnr = 1;
159
152
      optional uint32 compare_length = 2;
160
153
      optional bool in_reverse_order = 3 [default = false];
161
 
 
162
 
      optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
163
154
    }
164
155
 
165
 
    message IndexOptions {
 
156
    message Options {
166
157
      optional bool pack_key = 1;
167
158
      optional bool binary_pack_key = 2;
168
159
      optional bool var_length_key = 3;
178
169
    required IndexType type = 4 [default = UNKNOWN_INDEX];
179
170
    required uint32 key_length = 5;
180
171
    repeated IndexPart index_part = 6;
181
 
    optional IndexOptions options= 7;
 
172
    optional Options options= 7;
182
173
    optional string comment = 8;
183
174
  }
184
175
 
185
176
  required string name = 1;
186
177
  required string schema = 6;
187
178
  required TableType type = 5;
188
 
  required StorageEngine engine = 2;
 
179
  required Engine engine = 2;
189
180
  repeated Field field = 3;
190
181
  repeated Index indexes = 4;
191
182
 
192
183
  repeated ForeignKeyConstraint fk_constraint = 8;
193
184
  optional TableOptions options = 9;
194
 
  optional TableStats stats = 10;
195
185
  required uint64 creation_timestamp= 11 [default = 0];
196
186
  required uint64 update_timestamp= 12 [default = 0];
197
187
  optional string catalog = 13;
 
188
  optional string uuid = 14;
 
189
  /*
 
190
    A version value of 0, means that it was never set.
 
191
    */
 
192
  optional uint64 version = 15;
198
193
}
199
194
 
200
195
message AlterTable {