forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structured.pb.go
5883 lines (5712 loc) · 157 KB
/
structured.pb.go
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo.
// source: cockroach/pkg/sql/sqlbase/structured.proto
// DO NOT EDIT!
package sqlbase
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import cockroach_roachpb1 "github.com/cockroachdb/cockroach/pkg/roachpb"
import cockroach_util_hlc "github.com/cockroachdb/cockroach/pkg/util/hlc"
import github_com_cockroachdb_cockroach_pkg_roachpb "github.com/cockroachdb/cockroach/pkg/roachpb"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type ConstraintValidity int32
const (
ConstraintValidity_Validated ConstraintValidity = 0
ConstraintValidity_Unvalidated ConstraintValidity = 1
)
var ConstraintValidity_name = map[int32]string{
0: "Validated",
1: "Unvalidated",
}
var ConstraintValidity_value = map[string]int32{
"Validated": 0,
"Unvalidated": 1,
}
func (x ConstraintValidity) Enum() *ConstraintValidity {
p := new(ConstraintValidity)
*p = x
return p
}
func (x ConstraintValidity) String() string {
return proto.EnumName(ConstraintValidity_name, int32(x))
}
func (x *ConstraintValidity) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(ConstraintValidity_value, data, "ConstraintValidity")
if err != nil {
return err
}
*x = ConstraintValidity(value)
return nil
}
func (ConstraintValidity) EnumDescriptor() ([]byte, []int) { return fileDescriptorStructured, []int{0} }
// These mirror the types supported by the sql/parser. See
// sql/parser/col_types.go.
type ColumnType_Kind int32
const (
ColumnType_BOOL ColumnType_Kind = 0
ColumnType_INT ColumnType_Kind = 1
ColumnType_FLOAT ColumnType_Kind = 2
ColumnType_DECIMAL ColumnType_Kind = 3
ColumnType_DATE ColumnType_Kind = 4
ColumnType_TIMESTAMP ColumnType_Kind = 5
ColumnType_INTERVAL ColumnType_Kind = 6
ColumnType_STRING ColumnType_Kind = 7
ColumnType_BYTES ColumnType_Kind = 8
ColumnType_TIMESTAMPTZ ColumnType_Kind = 9
ColumnType_COLLATEDSTRING ColumnType_Kind = 10
ColumnType_NAME ColumnType_Kind = 11
ColumnType_OID ColumnType_Kind = 12
// NULL is not supported as a table column type, however it can be
// transferred through distsql streams.
ColumnType_NULL ColumnType_Kind = 13
// Array and vector types.
//
// TODO(cuongdo): Fix this before allowing persistence of array/vector types
// It would be cleaner if when array_dimensions are specified, Kind is
// simply the parameterized type of the array. However, because Kind is used
// to determine type information elsewhere, it isn't possible to take the
// cleaner approach without an extensive refactoring.
ColumnType_INT_ARRAY ColumnType_Kind = 100
ColumnType_INT2VECTOR ColumnType_Kind = 200
)
var ColumnType_Kind_name = map[int32]string{
0: "BOOL",
1: "INT",
2: "FLOAT",
3: "DECIMAL",
4: "DATE",
5: "TIMESTAMP",
6: "INTERVAL",
7: "STRING",
8: "BYTES",
9: "TIMESTAMPTZ",
10: "COLLATEDSTRING",
11: "NAME",
12: "OID",
13: "NULL",
100: "INT_ARRAY",
200: "INT2VECTOR",
}
var ColumnType_Kind_value = map[string]int32{
"BOOL": 0,
"INT": 1,
"FLOAT": 2,
"DECIMAL": 3,
"DATE": 4,
"TIMESTAMP": 5,
"INTERVAL": 6,
"STRING": 7,
"BYTES": 8,
"TIMESTAMPTZ": 9,
"COLLATEDSTRING": 10,
"NAME": 11,
"OID": 12,
"NULL": 13,
"INT_ARRAY": 100,
"INT2VECTOR": 200,
}
func (x ColumnType_Kind) Enum() *ColumnType_Kind {
p := new(ColumnType_Kind)
*p = x
return p
}
func (x ColumnType_Kind) String() string {
return proto.EnumName(ColumnType_Kind_name, int32(x))
}
func (x *ColumnType_Kind) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(ColumnType_Kind_value, data, "ColumnType_Kind")
if err != nil {
return err
}
*x = ColumnType_Kind(value)
return nil
}
func (ColumnType_Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptorStructured, []int{0, 0} }
// The direction of a column in the index.
type IndexDescriptor_Direction int32
const (
IndexDescriptor_ASC IndexDescriptor_Direction = 0
IndexDescriptor_DESC IndexDescriptor_Direction = 1
)
var IndexDescriptor_Direction_name = map[int32]string{
0: "ASC",
1: "DESC",
}
var IndexDescriptor_Direction_value = map[string]int32{
"ASC": 0,
"DESC": 1,
}
func (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction {
p := new(IndexDescriptor_Direction)
*p = x
return p
}
func (x IndexDescriptor_Direction) String() string {
return proto.EnumName(IndexDescriptor_Direction_name, int32(x))
}
func (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(IndexDescriptor_Direction_value, data, "IndexDescriptor_Direction")
if err != nil {
return err
}
*x = IndexDescriptor_Direction(value)
return nil
}
func (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{5, 0}
}
// A descriptor within a mutation is unavailable for reads, writes
// and deletes. It is only available for implicit (internal to
// the database) writes and deletes depending on the state of the mutation.
type DescriptorMutation_State int32
const (
// Not used.
DescriptorMutation_UNKNOWN DescriptorMutation_State = 0
// Operations can use this invisible descriptor to implicitly
// delete entries.
// Column: A descriptor in this state is invisible to
// INSERT and UPDATE. DELETE must delete a column in this state.
// Index: A descriptor in this state is invisible to an INSERT.
// UPDATE must delete the old value of the index but doesn't write
// the new value. DELETE must delete the index.
//
// When deleting a descriptor, all descriptor related data
// (column or index data) can only be mass deleted once
// all the nodes have transitioned to the DELETE_ONLY state.
DescriptorMutation_DELETE_ONLY DescriptorMutation_State = 1
// Operations can use this invisible descriptor to implicitly
// write and delete entries.
// Column: INSERT will populate this column with the default
// value. UPDATE ignores this descriptor. DELETE must delete
// the column.
// Index: INSERT, UPDATE and DELETE treat this index like any
// other index.
//
// When adding a descriptor, all descriptor related data
// (column default or index data) can only be backfilled once
// all nodes have transitioned into the WRITE_ONLY state.
DescriptorMutation_WRITE_ONLY DescriptorMutation_State = 2
)
var DescriptorMutation_State_name = map[int32]string{
0: "UNKNOWN",
1: "DELETE_ONLY",
2: "WRITE_ONLY",
}
var DescriptorMutation_State_value = map[string]int32{
"UNKNOWN": 0,
"DELETE_ONLY": 1,
"WRITE_ONLY": 2,
}
func (x DescriptorMutation_State) Enum() *DescriptorMutation_State {
p := new(DescriptorMutation_State)
*p = x
return p
}
func (x DescriptorMutation_State) String() string {
return proto.EnumName(DescriptorMutation_State_name, int32(x))
}
func (x *DescriptorMutation_State) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(DescriptorMutation_State_value, data, "DescriptorMutation_State")
if err != nil {
return err
}
*x = DescriptorMutation_State(value)
return nil
}
func (DescriptorMutation_State) EnumDescriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{6, 0}
}
// Direction of mutation.
type DescriptorMutation_Direction int32
const (
// Not used.
DescriptorMutation_NONE DescriptorMutation_Direction = 0
// Descriptor is being added.
DescriptorMutation_ADD DescriptorMutation_Direction = 1
// Descriptor is being dropped.
DescriptorMutation_DROP DescriptorMutation_Direction = 2
)
var DescriptorMutation_Direction_name = map[int32]string{
0: "NONE",
1: "ADD",
2: "DROP",
}
var DescriptorMutation_Direction_value = map[string]int32{
"NONE": 0,
"ADD": 1,
"DROP": 2,
}
func (x DescriptorMutation_Direction) Enum() *DescriptorMutation_Direction {
p := new(DescriptorMutation_Direction)
*p = x
return p
}
func (x DescriptorMutation_Direction) String() string {
return proto.EnumName(DescriptorMutation_Direction_name, int32(x))
}
func (x *DescriptorMutation_Direction) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(DescriptorMutation_Direction_value, data, "DescriptorMutation_Direction")
if err != nil {
return err
}
*x = DescriptorMutation_Direction(value)
return nil
}
func (DescriptorMutation_Direction) EnumDescriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{6, 1}
}
// State is set if this TableDescriptor is in the process of being added or deleted.
// A non-public table descriptor cannot be leased.
// A schema changer observing DROP set will truncate the table and delete the
// descriptor.
// It is illegal to transition DROP to any other state.
type TableDescriptor_State int32
const (
// Not used.
TableDescriptor_PUBLIC TableDescriptor_State = 0
// Descriptor is being added.
TableDescriptor_ADD TableDescriptor_State = 1
// Descriptor is being dropped.
TableDescriptor_DROP TableDescriptor_State = 2
)
var TableDescriptor_State_name = map[int32]string{
0: "PUBLIC",
1: "ADD",
2: "DROP",
}
var TableDescriptor_State_value = map[string]int32{
"PUBLIC": 0,
"ADD": 1,
"DROP": 2,
}
func (x TableDescriptor_State) Enum() *TableDescriptor_State {
p := new(TableDescriptor_State)
*p = x
return p
}
func (x TableDescriptor_State) String() string {
return proto.EnumName(TableDescriptor_State_name, int32(x))
}
func (x *TableDescriptor_State) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(TableDescriptor_State_value, data, "TableDescriptor_State")
if err != nil {
return err
}
*x = TableDescriptor_State(value)
return nil
}
func (TableDescriptor_State) EnumDescriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{7, 0}
}
type ColumnType struct {
Kind ColumnType_Kind `protobuf:"varint,1,opt,name=kind,enum=cockroach.sql.sqlbase.ColumnType_Kind" json:"kind"`
// BIT, INT, FLOAT, DECIMAL, CHAR and BINARY
Width int32 `protobuf:"varint,2,opt,name=width" json:"width"`
// FLOAT and DECIMAL.
Precision int32 `protobuf:"varint,3,opt,name=precision" json:"precision"`
// The length of each dimension in the array. A dimension of -1 means that
// no bound was specified for that dimension.
ArrayDimensions []int32 `protobuf:"varint,4,rep,name=array_dimensions,json=arrayDimensions" json:"array_dimensions,omitempty"`
// Collated STRING, CHAR, and VARCHAR
Locale *string `protobuf:"bytes,5,opt,name=locale" json:"locale,omitempty"`
}
func (m *ColumnType) Reset() { *m = ColumnType{} }
func (m *ColumnType) String() string { return proto.CompactTextString(m) }
func (*ColumnType) ProtoMessage() {}
func (*ColumnType) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{0} }
type ForeignKeyReference struct {
Table ID `protobuf:"varint,1,opt,name=table,casttype=ID" json:"table"`
Index IndexID `protobuf:"varint,2,opt,name=index,casttype=IndexID" json:"index"`
Name string `protobuf:"bytes,3,opt,name=name" json:"name"`
Validity ConstraintValidity `protobuf:"varint,4,opt,name=validity,enum=cockroach.sql.sqlbase.ConstraintValidity" json:"validity"`
// If this FK only uses a prefix of the columns in its index, we record how
// many to avoid spuriously counting the additional cols as used by this FK.
SharedPrefixLen int32 `protobuf:"varint,5,opt,name=shared_prefix_len,json=sharedPrefixLen" json:"shared_prefix_len"`
}
func (m *ForeignKeyReference) Reset() { *m = ForeignKeyReference{} }
func (m *ForeignKeyReference) String() string { return proto.CompactTextString(m) }
func (*ForeignKeyReference) ProtoMessage() {}
func (*ForeignKeyReference) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{1} }
type ColumnDescriptor struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
ID ColumnID `protobuf:"varint,2,opt,name=id,casttype=ColumnID" json:"id"`
Type ColumnType `protobuf:"bytes,3,opt,name=type" json:"type"`
Nullable bool `protobuf:"varint,4,opt,name=nullable" json:"nullable"`
// Default expression to use to populate the column on insert if no
// value is provided.
DefaultExpr *string `protobuf:"bytes,5,opt,name=default_expr,json=defaultExpr" json:"default_expr,omitempty"`
Hidden bool `protobuf:"varint,6,opt,name=hidden" json:"hidden"`
}
func (m *ColumnDescriptor) Reset() { *m = ColumnDescriptor{} }
func (m *ColumnDescriptor) String() string { return proto.CompactTextString(m) }
func (*ColumnDescriptor) ProtoMessage() {}
func (*ColumnDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{2} }
// ColumnFamilyDescriptor is set of columns stored together in one kv entry.
type ColumnFamilyDescriptor struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
ID FamilyID `protobuf:"varint,2,opt,name=id,casttype=FamilyID" json:"id"`
// A list of column names of which the family is comprised. This list
// parallels the column_ids list. If duplicating the storage of the column
// names here proves to be prohibitive, we could clear this field before
// saving and reconstruct it after loading.
ColumnNames []string `protobuf:"bytes,3,rep,name=column_names,json=columnNames" json:"column_names,omitempty"`
// A list of column ids of which the family is comprised. This list parallels
// the column_names list.
ColumnIDs []ColumnID `protobuf:"varint,4,rep,name=column_ids,json=columnIds,casttype=ColumnID" json:"column_ids,omitempty"`
// If nonzero, the column involved in the single column optimization.
//
// Families store colums in a ValueType_TUPLE as repeated <colid><data>
// entries. As a space optimization and for backward compatibility, a single
// column is written without the columnid prefix. Because more columns could
// be added, it would be ambiguous which column was stored when read back in,
// so this field supplies it.
DefaultColumnID ColumnID `protobuf:"varint,5,opt,name=default_column_id,json=defaultColumnId,casttype=ColumnID" json:"default_column_id"`
}
func (m *ColumnFamilyDescriptor) Reset() { *m = ColumnFamilyDescriptor{} }
func (m *ColumnFamilyDescriptor) String() string { return proto.CompactTextString(m) }
func (*ColumnFamilyDescriptor) ProtoMessage() {}
func (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{3} }
// InterleaveDescriptor represents an index (either primary or secondary) that
// is interleaved into another table's data.
//
// Example:
// Table 1 -> /a/b
// Table 2 -> /a/b/c
// Table 3 -> /a/b/c/d
//
// There are two components (table 2 is the parent and table 1 is the
// grandparent) with shared lengths 2 and 1.
type InterleaveDescriptor struct {
// Ancestors contains the nesting of interleaves in the order they appear in
// an encoded key. This means they are always in the far-to-near ancestor
// order (e.g. grand-grand-parent, grand-parent, parent).
Ancestors []InterleaveDescriptor_Ancestor `protobuf:"bytes,1,rep,name=ancestors" json:"ancestors"`
}
func (m *InterleaveDescriptor) Reset() { *m = InterleaveDescriptor{} }
func (m *InterleaveDescriptor) String() string { return proto.CompactTextString(m) }
func (*InterleaveDescriptor) ProtoMessage() {}
func (*InterleaveDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{4} }
type InterleaveDescriptor_Ancestor struct {
// TableID the ID of the table being interleaved into.
TableID ID `protobuf:"varint,1,opt,name=table_id,json=tableId,casttype=ID" json:"table_id"`
// IndexID is the ID of the parent index being interleaved into.
IndexID IndexID `protobuf:"varint,2,opt,name=index_id,json=indexId,casttype=IndexID" json:"index_id"`
// SharedPrefixLen is how many fields are shared between a parent and child
// being interleaved, excluding any fields shared between parent and
// grandparent. Thus, the sum of SharedPrefixLens in the components of an
// InterleaveDescriptor is always strictly less than the number of fields
// in the index being interleaved.
SharedPrefixLen uint32 `protobuf:"varint,3,opt,name=shared_prefix_len,json=sharedPrefixLen" json:"shared_prefix_len"`
}
func (m *InterleaveDescriptor_Ancestor) Reset() { *m = InterleaveDescriptor_Ancestor{} }
func (m *InterleaveDescriptor_Ancestor) String() string { return proto.CompactTextString(m) }
func (*InterleaveDescriptor_Ancestor) ProtoMessage() {}
func (*InterleaveDescriptor_Ancestor) Descriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{4, 0}
}
// IndexDescriptor describes an index (primary or secondary).
//
// Sample field values on the following table:
//
// CREATE TABLE t (
// k1 INT NOT NULL, // column ID: 1
// k2 INT NOT NULL, // column ID: 2
// u INT NULL, // column ID: 3
// v INT NULL, // column ID: 4
// w INT NULL, // column ID: 5
// CONSTRAINT "primary" PRIMARY KEY (k1, k2),
// INDEX k1v (k1, v) STORING (w),
// FAMILY "primary" (k1, k2, u, v, w)
// )
//
// Primary index:
// name: primary
// id: 1
// unique: true
// column_names: k1, k2
// column_directions: ASC, ASC
// column_ids: 1, 2 // k1, k2
//
// [old STORING encoding] Index k1v (k1, v) STORING (w):
// name: k1v
// id: 2
// unique: false
// column_names: k1, v
// column_directions: ASC, ASC
// store_column_names: w
// column_ids: 1, 4 // k1, v
// extra_column_ids: 2, 5 // k2, w
//
// [new STORING encoding] Index k1v (k1, v) STORING (w):
// name: k1v
// id: 2
// unique: false
// column_names: k1, v
// column_directions: ASC, ASC
// store_column_names: w
// column_ids: 1, 4 // k1, v
// extra_column_ids: 2 // k2
// store_column_ids: 5 // w
type IndexDescriptor struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
ID IndexID `protobuf:"varint,2,opt,name=id,casttype=IndexID" json:"id"`
Unique bool `protobuf:"varint,3,opt,name=unique" json:"unique"`
// An ordered list of column names of which the index is comprised; these
// columns do not include any additional stored columns (which are in
// stored_column_names). This list parallels the column_ids list.
//
// Note: if duplicating the storage of the column names here proves to be
// prohibitive, we could clear this field before saving and reconstruct it
// after loading.
ColumnNames []string `protobuf:"bytes,4,rep,name=column_names,json=columnNames" json:"column_names,omitempty"`
// The sort direction of each column in column_names.
ColumnDirections []IndexDescriptor_Direction `protobuf:"varint,8,rep,name=column_directions,json=columnDirections,enum=cockroach.sql.sqlbase.IndexDescriptor_Direction" json:"column_directions,omitempty"`
// An ordered list of column names which the index stores in addition to the
// columns which are explicitly part of the index (STORING clause). Only used
// for secondary indexes.
StoreColumnNames []string `protobuf:"bytes,5,rep,name=store_column_names,json=storeColumnNames" json:"store_column_names,omitempty"`
// An ordered list of column IDs of which the index is comprised. This list
// parallels the column_names list and does not include any additional stored
// columns.
ColumnIDs []ColumnID `protobuf:"varint,6,rep,name=column_ids,json=columnIds,casttype=ColumnID" json:"column_ids,omitempty"`
// An ordered list of IDs for the additional columns associated with the
// index:
// - implicit columns, which are all the primary key columns that are not
// already part of the index (i.e. PrimaryIndex.column_ids - column_ids).
// - stored columns (the columns in store_column_names) if this index uses the
// old STORING encoding (key-encoded data).
//
// Only used for secondary indexes.
// For non-unique indexes, these columns are appended to the key.
// For unique indexes, these columns are stored in the value.
// This distinction exists because we want to be able to insert an entry using
// a single conditional put on the key.
ExtraColumnIDs []ColumnID `protobuf:"varint,7,rep,name=extra_column_ids,json=extraColumnIds,casttype=ColumnID" json:"extra_column_ids,omitempty"`
// An ordered list of column IDs that parallels store_column_names if this
// index uses the new STORING encoding (value-encoded data, always in the KV
// value).
StoreColumnIDs []ColumnID `protobuf:"varint,14,rep,name=store_column_ids,json=storeColumnIds,casttype=ColumnID" json:"store_column_ids,omitempty"`
// CompositeColumnIDs contains an ordered list of IDs of columns that appear
// in the index and have a composite encoding. Includes IDs from both
// column_ids and extra_column_ids.
CompositeColumnIDs []ColumnID `protobuf:"varint,13,rep,name=composite_column_ids,json=compositeColumnIds,casttype=ColumnID" json:"composite_column_ids,omitempty"`
ForeignKey ForeignKeyReference `protobuf:"bytes,9,opt,name=foreign_key,json=foreignKey" json:"foreign_key"`
ReferencedBy []ForeignKeyReference `protobuf:"bytes,10,rep,name=referenced_by,json=referencedBy" json:"referenced_by"`
// Interleave, if it's not the zero value, describes how this index's data is
// interleaved into another index's data.
Interleave InterleaveDescriptor `protobuf:"bytes,11,opt,name=interleave" json:"interleave"`
// InterleavedBy contains a reference to every table/index that is interleaved
// into this one.
InterleavedBy []ForeignKeyReference `protobuf:"bytes,12,rep,name=interleaved_by,json=interleavedBy" json:"interleaved_by"`
}
func (m *IndexDescriptor) Reset() { *m = IndexDescriptor{} }
func (m *IndexDescriptor) String() string { return proto.CompactTextString(m) }
func (*IndexDescriptor) ProtoMessage() {}
func (*IndexDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{5} }
// A DescriptorMutation represents a column or an index that
// has either been added or dropped and hasn't yet transitioned
// into a stable state: completely backfilled and visible, or
// completely deleted. A table descriptor in the middle of a
// schema change will have a DescriptorMutation FIFO queue
// containing each column/index descriptor being added or dropped.
type DescriptorMutation struct {
// Types that are valid to be assigned to Descriptor_:
// *DescriptorMutation_Column
// *DescriptorMutation_Index
Descriptor_ isDescriptorMutation_Descriptor_ `protobuf_oneof:"descriptor"`
State DescriptorMutation_State `protobuf:"varint,3,opt,name=state,enum=cockroach.sql.sqlbase.DescriptorMutation_State" json:"state"`
Direction DescriptorMutation_Direction `protobuf:"varint,4,opt,name=direction,enum=cockroach.sql.sqlbase.DescriptorMutation_Direction" json:"direction"`
// The mutation id used to group mutations that should be applied together.
// This is used for situations like creating a unique column, which
// involve adding two mutations: one for the column, and another for the
// unique constraint index.
MutationID MutationID `protobuf:"varint,5,opt,name=mutation_id,json=mutationId,casttype=MutationID" json:"mutation_id"`
// A schema change can involve running multiple processors backfilling
// or deleting data. They occasionally checkpoint Spans so that the
// processing can resume in the event of a node failure. The spans are
// non-overlapping contiguous areas of the KV space that still need to
// be processed.
ResumeSpans []cockroach_roachpb1.Span `protobuf:"bytes,6,rep,name=resume_spans,json=resumeSpans" json:"resume_spans"`
}
func (m *DescriptorMutation) Reset() { *m = DescriptorMutation{} }
func (m *DescriptorMutation) String() string { return proto.CompactTextString(m) }
func (*DescriptorMutation) ProtoMessage() {}
func (*DescriptorMutation) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{6} }
type isDescriptorMutation_Descriptor_ interface {
isDescriptorMutation_Descriptor_()
MarshalTo([]byte) (int, error)
Size() int
}
type DescriptorMutation_Column struct {
Column *ColumnDescriptor `protobuf:"bytes,1,opt,name=column,oneof"`
}
type DescriptorMutation_Index struct {
Index *IndexDescriptor `protobuf:"bytes,2,opt,name=index,oneof"`
}
func (*DescriptorMutation_Column) isDescriptorMutation_Descriptor_() {}
func (*DescriptorMutation_Index) isDescriptorMutation_Descriptor_() {}
func (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_ {
if m != nil {
return m.Descriptor_
}
return nil
}
func (m *DescriptorMutation) GetColumn() *ColumnDescriptor {
if x, ok := m.GetDescriptor_().(*DescriptorMutation_Column); ok {
return x.Column
}
return nil
}
func (m *DescriptorMutation) GetIndex() *IndexDescriptor {
if x, ok := m.GetDescriptor_().(*DescriptorMutation_Index); ok {
return x.Index
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*DescriptorMutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _DescriptorMutation_OneofMarshaler, _DescriptorMutation_OneofUnmarshaler, _DescriptorMutation_OneofSizer, []interface{}{
(*DescriptorMutation_Column)(nil),
(*DescriptorMutation_Index)(nil),
}
}
func _DescriptorMutation_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*DescriptorMutation)
// descriptor
switch x := m.Descriptor_.(type) {
case *DescriptorMutation_Column:
_ = b.EncodeVarint(1<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.Column); err != nil {
return err
}
case *DescriptorMutation_Index:
_ = b.EncodeVarint(2<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.Index); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("DescriptorMutation.Descriptor_ has unexpected type %T", x)
}
return nil
}
func _DescriptorMutation_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*DescriptorMutation)
switch tag {
case 1: // descriptor.column
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(ColumnDescriptor)
err := b.DecodeMessage(msg)
m.Descriptor_ = &DescriptorMutation_Column{msg}
return true, err
case 2: // descriptor.index
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(IndexDescriptor)
err := b.DecodeMessage(msg)
m.Descriptor_ = &DescriptorMutation_Index{msg}
return true, err
default:
return false, nil
}
}
func _DescriptorMutation_OneofSizer(msg proto.Message) (n int) {
m := msg.(*DescriptorMutation)
// descriptor
switch x := m.Descriptor_.(type) {
case *DescriptorMutation_Column:
s := proto.Size(x.Column)
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case *DescriptorMutation_Index:
s := proto.Size(x.Index)
n += proto.SizeVarint(2<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
// A TableDescriptor represents a table or view and is stored in a
// structured metadata key. The TableDescriptor has a globally-unique ID,
// while its member {Column,Index}Descriptors have locally-unique IDs.
type TableDescriptor struct {
// The table name. It should be normalized using sqlbase.NormalizeName()
// before comparing it.
Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
ID ID `protobuf:"varint,3,opt,name=id,casttype=ID" json:"id"`
// ID of the parent database.
ParentID ID `protobuf:"varint,4,opt,name=parent_id,json=parentId,casttype=ID" json:"parent_id"`
// Monotonically increasing version of the table descriptor.
//
// Invariants:
// 1. not more than two subsequent versions of the table
// descriptor can be leased. This is to make the system
// easy to reason about, by permiting mutation state
// changes (reflected in the next version), only when the existing
// state (reflected in the current version) is present on all
// outstanding unexpired leases.
// 2. A schema change command (ALTER, RENAME, etc) never directly
// increments the version. This allows the command to execute without
// waiting for the entire cluster to converge to a single version
// preventing weird deadlock situations. For instance, a transaction
// with a schema change command might use a descriptor lease that is
// at version: v - 1, and therefore deadlock when it tries to wait
// for version: v, in the process of incrementing it to v + 1.
// Therefore, a schema change command never increments the version,
// and instead, sets the up_version boolean to notify the schema
// changer execution engine that runs a future transaction to
// increment the version.
//
// The schema change commands must therefore make *safe* modifications
// to the table descriptor, such as scheduling long running schema
// changes through mutations for future execution, or making simple
// schema changes like RENAME that only modify the table descriptor in a
// single transaction.
//
// Multiple schema changes in the same transaction set up_version.
// The actual schema change execution that follows a schema change
// command sees the up_version boolean set, and increments the
// table version after ensuring that there are no unexpired leases
// for version - 1. The schema change execution must increment
// the version before executing future state changes, to ensure
// that the scheduled mutations made by the original commands are
// visible on all leases. Multiple schema change mutations can be
// grouped together on a particular version increment.
//
// If schema change commands are safe to run without incrementing
// the version, why do it later on? We increment the version
// to ensure that all the nodes renew their leases with the new version
// and get to see what the schema change command has done quickly.
Version DescriptorVersion `protobuf:"varint,5,opt,name=version,casttype=DescriptorVersion" json:"version"`
// See comment above.
UpVersion bool `protobuf:"varint,6,opt,name=up_version,json=upVersion" json:"up_version"`
// Last modification time of the table descriptor.
ModificationTime cockroach_util_hlc.Timestamp `protobuf:"bytes,7,opt,name=modification_time,json=modificationTime" json:"modification_time"`
Columns []ColumnDescriptor `protobuf:"bytes,8,rep,name=columns" json:"columns"`
// next_column_id is used to ensure that deleted column ids are not reused.
NextColumnID ColumnID `protobuf:"varint,9,opt,name=next_column_id,json=nextColumnId,casttype=ColumnID" json:"next_column_id"`
Families []ColumnFamilyDescriptor `protobuf:"bytes,22,rep,name=families" json:"families"`
// next_family_id is used to ensure that deleted family ids are not reused.
NextFamilyID FamilyID `protobuf:"varint,23,opt,name=next_family_id,json=nextFamilyId,casttype=FamilyID" json:"next_family_id"`
PrimaryIndex IndexDescriptor `protobuf:"bytes,10,opt,name=primary_index,json=primaryIndex" json:"primary_index"`
// indexes are all the secondary indexes.
Indexes []IndexDescriptor `protobuf:"bytes,11,rep,name=indexes" json:"indexes"`
// next_index_id is used to ensure that deleted index ids are not reused.
NextIndexID IndexID `protobuf:"varint,12,opt,name=next_index_id,json=nextIndexId,casttype=IndexID" json:"next_index_id"`
Privileges *PrivilegeDescriptor `protobuf:"bytes,13,opt,name=privileges" json:"privileges,omitempty"`
// Columns or indexes being added or deleted in a FIFO order.
Mutations []DescriptorMutation `protobuf:"bytes,14,rep,name=mutations" json:"mutations"`
Lease *TableDescriptor_SchemaChangeLease `protobuf:"bytes,15,opt,name=lease" json:"lease,omitempty"`
// An id for the next group of mutations to be applied together.
NextMutationID MutationID `protobuf:"varint,16,opt,name=next_mutation_id,json=nextMutationId,casttype=MutationID" json:"next_mutation_id"`
// format_version declares which sql to key:value mapping is being used to
// represent the data in this table.
FormatVersion FormatVersion `protobuf:"varint,17,opt,name=format_version,json=formatVersion,casttype=FormatVersion" json:"format_version"`
State TableDescriptor_State `protobuf:"varint,19,opt,name=state,enum=cockroach.sql.sqlbase.TableDescriptor_State" json:"state"`
Checks []*TableDescriptor_CheckConstraint `protobuf:"bytes,20,rep,name=checks" json:"checks,omitempty"`
// This array is populated if the descriptor was renamed. If the descriptor is
// renamed multiple times before the schema chage is processed, there will be
// one element for each rename.
// When this is detected in a schema change, the records for the old names are
// deleted and this field is cleared.
Renames []TableDescriptor_RenameInfo `protobuf:"bytes,21,rep,name=renames" json:"renames"`
// The TableDescriptor is used for views in addition to tables. Views
// use mostly the same fields as tables, but need to track the actual
// query from the view definition as well.
//
// For now we only track a string representation of the query. This prevents
// us from easily supporting things like renames of the dependencies of a
// view. Eventually we'll want to switch to a semantic encoding of the query
// that relies on IDs rather than names so that we can support renames of
// fields relied on by the query, as Postgres does.
//
// Note: The presence of this field is used to determine whether or not
// a TableDescriptor represents a view.
ViewQuery string `protobuf:"bytes,24,opt,name=view_query,json=viewQuery" json:"view_query"`
// The IDs of all relations that this depends on.
// Only ever populated if this descriptor is for a view.
DependsOn []ID `protobuf:"varint,25,rep,name=dependsOn,casttype=ID" json:"dependsOn,omitempty"`
// All references to this table/view from other views in the system, tracked
// down to the column/index so that we can restrict changes to them while
// they're still being referred to.
DependedOnBy []TableDescriptor_Reference `protobuf:"bytes,26,rep,name=dependedOnBy" json:"dependedOnBy"`
}
func (m *TableDescriptor) Reset() { *m = TableDescriptor{} }
func (m *TableDescriptor) String() string { return proto.CompactTextString(m) }
func (*TableDescriptor) ProtoMessage() {}
func (*TableDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorStructured, []int{7} }
func (m *TableDescriptor) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *TableDescriptor) GetID() ID {
if m != nil {
return m.ID
}
return 0
}
func (m *TableDescriptor) GetParentID() ID {
if m != nil {
return m.ParentID
}
return 0
}
func (m *TableDescriptor) GetVersion() DescriptorVersion {
if m != nil {
return m.Version
}
return 0
}
func (m *TableDescriptor) GetUpVersion() bool {
if m != nil {
return m.UpVersion
}
return false
}
func (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp {
if m != nil {
return m.ModificationTime
}
return cockroach_util_hlc.Timestamp{}
}
func (m *TableDescriptor) GetColumns() []ColumnDescriptor {
if m != nil {
return m.Columns
}
return nil
}
func (m *TableDescriptor) GetNextColumnID() ColumnID {
if m != nil {
return m.NextColumnID
}
return 0
}
func (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor {
if m != nil {
return m.Families
}
return nil
}
func (m *TableDescriptor) GetNextFamilyID() FamilyID {
if m != nil {
return m.NextFamilyID
}
return 0
}
func (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor {
if m != nil {
return m.PrimaryIndex
}
return IndexDescriptor{}
}
func (m *TableDescriptor) GetIndexes() []IndexDescriptor {
if m != nil {
return m.Indexes
}
return nil
}
func (m *TableDescriptor) GetNextIndexID() IndexID {
if m != nil {
return m.NextIndexID
}
return 0
}
func (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor {
if m != nil {
return m.Privileges
}
return nil
}
func (m *TableDescriptor) GetMutations() []DescriptorMutation {
if m != nil {
return m.Mutations
}
return nil
}
func (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease {
if m != nil {
return m.Lease
}
return nil
}
func (m *TableDescriptor) GetNextMutationID() MutationID {
if m != nil {
return m.NextMutationID
}
return 0
}
func (m *TableDescriptor) GetFormatVersion() FormatVersion {
if m != nil {
return m.FormatVersion
}
return 0
}
func (m *TableDescriptor) GetState() TableDescriptor_State {
if m != nil {
return m.State
}
return TableDescriptor_PUBLIC
}
func (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint {
if m != nil {
return m.Checks
}
return nil
}
func (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo {
if m != nil {
return m.Renames
}
return nil
}
func (m *TableDescriptor) GetViewQuery() string {
if m != nil {
return m.ViewQuery
}
return ""
}
func (m *TableDescriptor) GetDependsOn() []ID {
if m != nil {
return m.DependsOn
}
return nil
}
func (m *TableDescriptor) GetDependedOnBy() []TableDescriptor_Reference {
if m != nil {
return m.DependedOnBy
}
return nil
}
// The schema update lease. A single goroutine across a cockroach cluster
// can own it, and will execute pending schema changes for this table.
// Since the execution of a pending schema change is through transactions,
// it is legal for more than one goroutine to attempt to execute it. This
// lease reduces write contention on the schema change.
type TableDescriptor_SchemaChangeLease struct {
NodeID github_com_cockroachdb_cockroach_pkg_roachpb.NodeID `protobuf:"varint,1,opt,name=node_id,json=nodeId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" json:"node_id"`
// Nanoseconds since the Unix epoch.
ExpirationTime int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time"`
}
func (m *TableDescriptor_SchemaChangeLease) Reset() { *m = TableDescriptor_SchemaChangeLease{} }
func (m *TableDescriptor_SchemaChangeLease) String() string { return proto.CompactTextString(m) }
func (*TableDescriptor_SchemaChangeLease) ProtoMessage() {}
func (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int) {
return fileDescriptorStructured, []int{7, 0}
}
type TableDescriptor_CheckConstraint struct {
Expr string `protobuf:"bytes,1,opt,name=expr" json:"expr"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name"`
Validity ConstraintValidity `protobuf:"varint,3,opt,name=validity,enum=cockroach.sql.sqlbase.ConstraintValidity" json:"validity"`
}
func (m *TableDescriptor_CheckConstraint) Reset() { *m = TableDescriptor_CheckConstraint{} }
func (m *TableDescriptor_CheckConstraint) String() string { return proto.CompactTextString(m) }