{"modulePath":"github.com/tescherm/cockroach","version":"v0.0.0-20160518190125-12475580960a","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlbase\n\nPackage sqlbase is a generated protocol buffer package.\n\nIt is generated from these files:\n\n\tcockroach/sql/sqlbase/privilege.proto\n\tcockroach/sql/sqlbase/structured.proto\n\nIt has these top-level messages:\n\n\tUserPrivileges\n\tPrivilegeDescriptor\n\tColumnType\n\tColumnDescriptor\n\tIndexDescriptor\n\tDescriptorMutation\n\tTableDescriptor\n\tDatabaseDescriptor\n\tDescriptor\n\n## Constants\n\n```go\nconst (\n\t// PrimaryKeyIndexName is the name of the index for the primary key.\n\tPrimaryKeyIndexName = \"primary\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrInvalidLengthPrivilege = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowPrivilege   = fmt.Errorf(\"proto: integer overflow\")\n)\n```\n\n```go\nvar (\n\tErrInvalidLengthStructured = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowStructured   = fmt.Errorf(\"proto: integer overflow\")\n)\n```\n\n```go\nvar (\n\t// SystemDB is the descriptor for the system database.\n\tSystemDB = DatabaseDescriptor{\n\t\tName: \"system\",\n\t\tID:   keys.SystemDatabaseID,\n\n\t\tPrivileges: NewPrivilegeDescriptor(security.RootUser,\n\t\t\tSystemAllowedPrivileges[keys.SystemDatabaseID]),\n\t}\n\n\t// DescriptorTable is the descriptor for the descriptor table.\n\tDescriptorTable = createSystemTable(keys.DescriptorTableID, descriptorTableSchema)\n\n\t// SystemAllowedPrivileges describes the privileges allowed for each\n\t// system object. No user may have more than those privileges, and\n\t// the root user must have exactly those privileges.\n\t// CREATE|DROP|ALL should always be denied.\n\tSystemAllowedPrivileges = map[ID]privilege.List{\n\t\tkeys.SystemDatabaseID:  privilege.ReadData,\n\t\tkeys.NamespaceTableID:  privilege.ReadData,\n\t\tkeys.DescriptorTableID: privilege.ReadData,\n\t\tkeys.UsersTableID:      privilege.ReadWriteData,\n\t\tkeys.ZonesTableID:      privilege.ReadWriteData,\n\t\tkeys.LeaseTableID:      privilege.ReadWriteData,\n\t\tkeys.RangeEventTableID: privilege.ReadWriteData,\n\t\tkeys.UITableID:         privilege.ReadWriteData,\n\t}\n\n\t// NumSystemDescriptors should be set to the number of system descriptors\n\t// above (SystemDB and each system table). This is used by tests which need\n\t// to know the number of system descriptors intended for installation; it starts at\n\t// 1 for the SystemDB descriptor created above, and is incremented by every\n\t// call to createSystemTable().\n\tNumSystemDescriptors = 1\n)\n```\n\n```go\nvar ColumnType_Kind_name = map[int32]string{\n\t0: \"BOOL\",\n\t1: \"INT\",\n\t2: \"FLOAT\",\n\t3: \"DECIMAL\",\n\t4: \"DATE\",\n\t5: \"TIMESTAMP\",\n\t6: \"INTERVAL\",\n\t7: \"STRING\",\n\t8: \"BYTES\",\n\t9: \"TIMESTAMPTZ\",\n}\n```\n\n```go\nvar ColumnType_Kind_value = map[string]int32{\n\t\"BOOL\":        0,\n\t\"INT\":         1,\n\t\"FLOAT\":       2,\n\t\"DECIMAL\":     3,\n\t\"DATE\":        4,\n\t\"TIMESTAMP\":   5,\n\t\"INTERVAL\":    6,\n\t\"STRING\":      7,\n\t\"BYTES\":       8,\n\t\"TIMESTAMPTZ\": 9,\n}\n```\n\n```go\nvar DescriptorMutation_Direction_name = map[int32]string{\n\t0: \"NONE\",\n\t1: \"ADD\",\n\t2: \"DROP\",\n}\n```\n\n```go\nvar DescriptorMutation_Direction_value = map[string]int32{\n\t\"NONE\": 0,\n\t\"ADD\":  1,\n\t\"DROP\": 2,\n}\n```\n\n```go\nvar DescriptorMutation_State_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"DELETE_ONLY\",\n\t2: \"WRITE_ONLY\",\n}\n```\n\n```go\nvar DescriptorMutation_State_value = map[string]int32{\n\t\"UNKNOWN\":     0,\n\t\"DELETE_ONLY\": 1,\n\t\"WRITE_ONLY\":  2,\n}\n```\n\n```go\nvar ErrMissingColumns = errors.New(\"table must contain at least 1 column\")\n```\nErrMissingColumns indicates a table with no columns.\n\n```go\nvar ErrMissingPrimaryKey = errors.New(\"table must contain a primary key\")\n```\nErrMissingPrimaryKey indicates a table with no primary key.\n\n```go\nvar IndexDescriptor_Direction_name = map[int32]string{\n\t0: \"ASC\",\n\t1: \"DESC\",\n}\n```\n\n```go\nvar IndexDescriptor_Direction_value = map[string]int32{\n\t\"ASC\":  0,\n\t\"DESC\": 1,\n}\n```\n\n```go\nvar TableDescriptor_State_name = map[int32]string{\n\t0: \"PUBLIC\",\n\t2: \"DROP\",\n}\n```\n\n```go\nvar TableDescriptor_State_value = map[string]int32{\n\t\"PUBLIC\": 0,\n\t\"DROP\":   2,\n}\n```\n\n## Functions\n\n```go\nfunc CheckColumnType(col ColumnDescriptor, val parser.Datum, args parser.MapArgs) error\n```\nCheckColumnType verifies that a given value is compatible with the type requested by the column. If the value is a placeholder, the type of the placeholder gets populated.\n\n```go\nfunc CheckValueWidth(col ColumnDescriptor, val parser.Datum) error\n```\nCheckValueWidth checks that the width (for strings/byte arrays) and scale (for decimals) of the value fits the specified column type. Used by INSERT and UPDATE.\n\n```go\nfunc ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs\n```\nColumnsSelectors generates Select expressions for cols.\n\n```go\nfunc DecodeIndexKey(\n\ta *DatumAlloc,\n\tdesc *TableDescriptor,\n\tindexID IndexID,\n\tvalTypes, vals []parser.Datum,\n\tcolDirs []encoding.Direction,\n\tkey []byte,\n) ([]byte, error)\n```\nDecodeIndexKey decodes the values that are a part of the specified index key. ValTypes is a slice returned from makeKeyVals. The remaining bytes in the index key are returned which will either be an encoded column ID for the primary key index, the primary key suffix for non-unique secondary indexes or unique secondary indexes containing NULL or empty.\n\n```go\nfunc DecodeKeyVals(a *DatumAlloc, valTypes, vals []parser.Datum,\n\tdirections []encoding.Direction, key []byte) ([]byte, error)\n```\nDecodeKeyVals decodes the values that are part of the key. ValTypes is a slice returned from makeKeyVals. The decoded values are stored in the vals parameter while the valTypes parameter is unmodified. Note that len(vals) \u003e= len(valTypes). The types of the decoded values will match the corresponding entry in the valTypes parameter with the exception that a value might also be parser.DNull. The remaining bytes in the key after decoding the values are returned. A slice of directions can be provided to enforce encoding direction on each value in valTypes. If this slice is nil, the direction used will default to encoding.Ascending.\n\n```go\nfunc DecodeTableKey(\n\ta *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction,\n) (parser.Datum, []byte, error)\n```\nDecodeTableKey decodes a table key/value.\n\n```go\nfunc EncodeColumns(\n\tcolumnIDs []ColumnID,\n\tdirections []encoding.Direction,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n\tindexKey []byte,\n) ([]byte, bool, error)\n```\nEncodeColumns is a version of EncodeIndexKey that takes ColumnIDs and directions explicitly.\n\n```go\nfunc EncodeDTuple(b []byte, d parser.DTuple) ([]byte, error)\n```\nEncodeDTuple encodes a DTuple (order-preserving).\n\n```go\nfunc EncodeDatum(b []byte, d parser.Datum) ([]byte, error)\n```\nEncodeDatum encodes a datum (order-preserving encoding, suitable for keys).\n\n```go\nfunc EncodeIndexKey(index *IndexDescriptor, colMap map[ColumnID]int,\n\tvalues []parser.Datum, indexKey []byte) ([]byte, bool, error)\n```\nEncodeIndexKey doesn't deal with ImplicitColumnIDs, so it doesn't always produce a full index key.\n\n```go\nfunc EncodeTableKey(b []byte, val parser.Datum, dir encoding.Direction) ([]byte, error)\n```\nEncodeTableKey encodes \\`val\\` into \\`b\\` and returns the new buffer.\n\n```go\nfunc EqualName(a, b string) bool\n```\nEqualName returns true iff the normalizations of a and b are equal.\n\n```go\nfunc ExtractIndexKey(\n\ta *DatumAlloc,\n\ttableDesc *TableDescriptor,\n\tentry client.KeyValue,\n) (roachpb.Key, error)\n```\nExtractIndexKey constructs the index (primary) key for a row from any index key/value entry, including secondary indexes.\n\n```go\nfunc IsSystemConfigID(id ID) bool\n```\nIsSystemConfigID returns true if this ID is for a system config object.\n\n```go\nfunc MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)\n```\nMakeColumnDefDescs creates the column descriptor for a column, as well as the index descriptor if the column is a primary key or unique.\n\n```go\nfunc MakeDescMetadataKey(descID ID) roachpb.Key\n```\nMakeDescMetadataKey returns the key for the descriptor.\n\n```go\nfunc MakeIndexKeyPrefix(tableID ID, indexID IndexID) []byte\n```\nMakeIndexKeyPrefix returns the key prefix used for the index's data.\n\n```go\nfunc MakeKeyVals(\n\tdesc *TableDescriptor, columnIDs []ColumnID,\n) ([]parser.Datum, error)\n```\nMakeKeyVals returns a slice of Datums with the correct types for the given columns.\n\n```go\nfunc MakeNameMetadataKey(parentID ID, name string) roachpb.Key\n```\nMakeNameMetadataKey returns the key for the name. Pass name == \"\" in order to generate the prefix key to use to scan over all of the names for the specified parentID.\n\n```go\nfunc MakeZoneKey(id ID) roachpb.Key\n```\nMakeZoneKey returns the key for 'id's entry in the system.zones table.\n\n```go\nfunc MarshalColumnValue(col ColumnDescriptor, val parser.Datum) (roachpb.Value, error)\n```\nMarshalColumnValue returns a Go primitive value equivalent of val, of the type expected by col. If val's type is incompatible with col, or if col's type is not yet implemented, an error is returned.\n\n```go\nfunc NormalizeName(name string) string\n```\nNormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).\n\n```go\nfunc PrettySpan(span Span, skip int) string\n```\nPrettySpan returns a human-readable representation of a span.\n\n```go\nfunc PrettySpans(spans []Span, skip int) string\n```\nPrettySpans returns a human-readable description of the spans.\n\n```go\nfunc RunFilter(filter parser.TypedExpr, evalCtx parser.EvalContext) (bool, error)\n```\nRunFilter runs a filter expression and returns whether the filter passes.\n\n```go\nfunc SanitizeDefaultExpr(expr parser.Expr, colDatumType parser.Datum) error\n```\nSanitizeDefaultExpr verifies a default expression is valid and has the correct type.\n\n```go\nfunc SetKVBatchSize(val int64) func()\n```\nSetKVBatchSize changes the kvFetcher batch size, and returns a function that restores it.\n\n```go\nfunc StripColumnIDLength(key roachpb.Key) roachpb.Key\n```\nStripColumnIDLength strips off a one byte suffix from the key.\n\n```go\nfunc UnmarshalColumnValue(\n\ta *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value,\n) (parser.Datum, error)\n```\nUnmarshalColumnValue decodes the value from a key-value pair using the type expected by the column. An error is returned if the value's type does not match the column's type.\n\n## Types\n\n```go\ntype ColumnDescriptor struct {\n\tName     string     `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID       ColumnID   `protobuf:\"varint,2,opt,name=id,casttype=ColumnID\" json:\"id\"`\n\tType     ColumnType `protobuf:\"bytes,3,opt,name=type\" json:\"type\"`\n\tNullable bool       `protobuf:\"varint,4,opt,name=nullable\" json:\"nullable\"`\n\t// Default expression to use to populate the column on insert if no\n\t// value is provided.\n\tDefaultExpr *string `protobuf:\"bytes,5,opt,name=default_expr,json=defaultExpr\" json:\"default_expr,omitempty\"`\n\tHidden      bool    `protobuf:\"varint,6,opt,name=hidden\" json:\"hidden\"`\n}\n```\n\n```go\nfunc (*ColumnDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *ColumnDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ColumnDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*ColumnDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *ColumnDescriptor) Reset()\n```\n\n```go\nfunc (m *ColumnDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *ColumnDescriptor) String() string\n```\n\n```go\nfunc (m *ColumnDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnID uint32\n```\nColumnID is a custom type for ColumnDescriptor IDs.\n\n```go\ntype ColumnType struct {\n\tKind ColumnType_Kind `protobuf:\"varint,1,opt,name=kind,enum=cockroach.sql.sqlbase.ColumnType_Kind\" json:\"kind\"`\n\t// BIT, INT, FLOAT, DECIMAL, CHAR and BINARY\n\tWidth int32 `protobuf:\"varint,2,opt,name=width\" json:\"width\"`\n\t// FLOAT and DECIMAL.\n\tPrecision int32 `protobuf:\"varint,3,opt,name=precision\" json:\"precision\"`\n}\n```\n\n```go\nfunc (*ColumnType) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *ColumnType) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *ColumnType) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*ColumnType) ProtoMessage()\n```\n\n```go\nfunc (m *ColumnType) Reset()\n```\n\n```go\nfunc (c *ColumnType) SQLString() string\n```\nSQLString returns the SQL string corresponding to the type.\n\n```go\nfunc (m *ColumnType) Size() (n int)\n```\n\n```go\nfunc (m *ColumnType) String() string\n```\n\n```go\nfunc (c *ColumnType) ToDatumType() parser.Datum\n```\nToDatumType converts the ColumnType to the correct type Datum, or nil if there is no correspondence.\n\n```go\nfunc (m *ColumnType) Unmarshal(data []byte) error\n```\n\n```go\ntype ColumnType_Kind int32\n```\nThese mirror the types supported by the sql/parser. See sql/parser/types.go.\n\n```go\nconst (\n\tColumnType_BOOL        ColumnType_Kind = 0\n\tColumnType_INT         ColumnType_Kind = 1\n\tColumnType_FLOAT       ColumnType_Kind = 2\n\tColumnType_DECIMAL     ColumnType_Kind = 3\n\tColumnType_DATE        ColumnType_Kind = 4\n\tColumnType_TIMESTAMP   ColumnType_Kind = 5\n\tColumnType_INTERVAL    ColumnType_Kind = 6\n\tColumnType_STRING      ColumnType_Kind = 7\n\tColumnType_BYTES       ColumnType_Kind = 8\n\tColumnType_TIMESTAMPTZ ColumnType_Kind = 9\n)\n```\n\n```go\nfunc (x ColumnType_Kind) Enum() *ColumnType_Kind\n```\n\n```go\nfunc (ColumnType_Kind) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x ColumnType_Kind) String() string\n```\n\n```go\nfunc (k ColumnType_Kind) ToDatumType() parser.Datum\n```\nToDatumType converts the ColumnType\\_Kind to the correct type Datum, or nil if there is no correspondence.\n\n```go\nfunc (x *ColumnType_Kind) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DatabaseDescriptor struct {\n\tName       string               `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID         ID                   `protobuf:\"varint,2,opt,name=id,casttype=ID\" json:\"id\"`\n\tPrivileges *PrivilegeDescriptor `protobuf:\"bytes,3,opt,name=privileges\" json:\"privileges,omitempty\"`\n}\n```\nDatabaseDescriptor represents a namespace (aka database) and is stored in a structured metadata key. The DatabaseDescriptor has a globally-unique ID shared with the TableDescriptor ID. Permissions are applied to all tables in the namespace.\n\n```go\nfunc (*DatabaseDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetID() ID\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetName() string\n```\n\n```go\nfunc (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor\n```\n\n```go\nfunc (m *DatabaseDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*DatabaseDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *DatabaseDescriptor) Reset()\n```\n\n```go\nfunc (desc *DatabaseDescriptor) SetID(id ID)\n```\nSetID implements the DescriptorProto interface.\n\n```go\nfunc (desc *DatabaseDescriptor) SetName(name string)\n```\nSetName implements the DescriptorProto interface.\n\n```go\nfunc (m *DatabaseDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *DatabaseDescriptor) String() string\n```\n\n```go\nfunc (desc *DatabaseDescriptor) TypeName() string\n```\nTypeName returns the plain type of this descriptor.\n\n```go\nfunc (m *DatabaseDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (desc *DatabaseDescriptor) Validate() error\n```\nValidate validates that the database descriptor is well formed. Checks include validate the database name, and verifying that there is at least one read and write user.\n\n```go\ntype DatumAlloc struct {\n\t// contains filtered or unexported fields\n}\n```\nDatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations.\n\n```go\nfunc (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes\n```\nNewDBytes allocates a DBytes.\n\n```go\nfunc (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate\n```\nNewDDate allocates a DDate.\n\n```go\nfunc (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal\n```\nNewDDecimal allocates a DDecimal.\n\n```go\nfunc (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat\n```\nNewDFloat allocates a DFloat.\n\n```go\nfunc (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt\n```\nNewDInt allocates a DInt.\n\n```go\nfunc (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval\n```\nNewDInterval allocates a DInterval.\n\n```go\nfunc (a *DatumAlloc) NewDString(v parser.DString) *parser.DString\n```\nNewDString allocates a DString.\n\n```go\nfunc (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp\n```\nNewDTimestamp allocates a DTimestamp.\n\n```go\nfunc (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ\n```\nNewDTimestampTZ allocates a DTimestampTZ.\n\n```go\ntype DatumEncoding int32\n```\nDatumEncoding identifies the encoding used for an EncDatum.\n\n```go\nconst (\n\tNoEncoding DatumEncoding = iota\n\tAscendingKeyEncoding\n\tDescendingKeyEncoding\n)\n```\nPossible encodings.\n\n```go\ntype Descriptor struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*Descriptor_Table\n\t//\t*Descriptor_Database\n\tUnion isDescriptor_Union `protobuf_oneof:\"union\"`\n}\n```\nDescriptor is a union type holding either a table or database descriptor.\n\n```go\nfunc WrapDescriptor(descriptor DescriptorProto) *Descriptor\n```\nWrapDescriptor fills in a Descriptor.\n\n```go\nfunc (*Descriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *Descriptor) GetDatabase() *DatabaseDescriptor\n```\n\n```go\nfunc (desc *Descriptor) GetID() ID\n```\nGetID returns the ID of the descriptor.\n\n```go\nfunc (desc *Descriptor) GetName() string\n```\nGetName returns the Name of the descriptor.\n\n```go\nfunc (m *Descriptor) GetTable() *TableDescriptor\n```\n\n```go\nfunc (m *Descriptor) GetUnion() isDescriptor_Union\n```\n\n```go\nfunc (m *Descriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *Descriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*Descriptor) ProtoMessage()\n```\n\n```go\nfunc (m *Descriptor) Reset()\n```\n\n```go\nfunc (m *Descriptor) Size() (n int)\n```\n\n```go\nfunc (m *Descriptor) String() string\n```\n\n```go\nfunc (m *Descriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (*Descriptor) 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{})\n```\nXXX\\_OneofFuncs is for the internal use of the proto package.\n\n```go\ntype DescriptorKey interface {\n\tKey() roachpb.Key\n\tName() string\n}\n```\nDescriptorKey is the interface implemented by both databaseKey and tableKey. It is used to easily get the descriptor key and plain name.\n\n```go\ntype DescriptorMutation struct {\n\t// Types that are valid to be assigned to Descriptor_:\n\t//\t*DescriptorMutation_Column\n\t//\t*DescriptorMutation_Index\n\tDescriptor_ isDescriptorMutation_Descriptor_ `protobuf_oneof:\"descriptor\"`\n\tState       DescriptorMutation_State         `protobuf:\"varint,3,opt,name=state,enum=cockroach.sql.sqlbase.DescriptorMutation_State\" json:\"state\"`\n\tDirection   DescriptorMutation_Direction     `protobuf:\"varint,4,opt,name=direction,enum=cockroach.sql.sqlbase.DescriptorMutation_Direction\" json:\"direction\"`\n\t// The mutation id used to group mutations that should be applied together.\n\t// This is used for situations like creating a unique column, which\n\t// involve adding two mutations: one for the column, and another for the\n\t// unique constraint index.\n\tMutationID MutationID `protobuf:\"varint,5,opt,name=mutation_id,json=mutationId,casttype=MutationID\" json:\"mutation_id\"`\n}\n```\nA 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.\n\n```go\nfunc (*DescriptorMutation) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *DescriptorMutation) GetColumn() *ColumnDescriptor\n```\n\n```go\nfunc (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_\n```\n\n```go\nfunc (m *DescriptorMutation) GetIndex() *IndexDescriptor\n```\n\n```go\nfunc (m *DescriptorMutation) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *DescriptorMutation) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*DescriptorMutation) ProtoMessage()\n```\n\n```go\nfunc (m *DescriptorMutation) Reset()\n```\n\n```go\nfunc (m *DescriptorMutation) Size() (n int)\n```\n\n```go\nfunc (m *DescriptorMutation) String() string\n```\n\n```go\nfunc (m *DescriptorMutation) Unmarshal(data []byte) error\n```\n\n```go\nfunc (*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{})\n```\nXXX\\_OneofFuncs is for the internal use of the proto package.\n\n```go\ntype DescriptorMutation_Column struct {\n\tColumn *ColumnDescriptor `protobuf:\"bytes,1,opt,name=column,oneof\"`\n}\n```\n\n```go\nfunc (m *DescriptorMutation_Column) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *DescriptorMutation_Column) Size() (n int)\n```\n\n```go\ntype DescriptorMutation_Direction int32\n```\nDirection of mutation.\n\n```go\nconst (\n\t// Not used.\n\tDescriptorMutation_NONE DescriptorMutation_Direction = 0\n\t// Descriptor is being added.\n\tDescriptorMutation_ADD DescriptorMutation_Direction = 1\n\t// Descriptor is being dropped.\n\tDescriptorMutation_DROP DescriptorMutation_Direction = 2\n)\n```\n\n```go\nfunc (x DescriptorMutation_Direction) Enum() *DescriptorMutation_Direction\n```\n\n```go\nfunc (DescriptorMutation_Direction) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x DescriptorMutation_Direction) String() string\n```\n\n```go\nfunc (x *DescriptorMutation_Direction) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DescriptorMutation_Index struct {\n\tIndex *IndexDescriptor `protobuf:\"bytes,2,opt,name=index,oneof\"`\n}\n```\n\n```go\nfunc (m *DescriptorMutation_Index) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *DescriptorMutation_Index) Size() (n int)\n```\n\n```go\ntype DescriptorMutation_State int32\n```\nA 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.\n\n```go\nconst (\n\t// Not used.\n\tDescriptorMutation_UNKNOWN DescriptorMutation_State = 0\n\t// Operations can use this invisible descriptor to implicitly\n\t// delete entries.\n\t// Column: A descriptor in this state is invisible to\n\t// INSERT and UPDATE. DELETE must delete a column in this state.\n\t// Index: A descriptor in this state is invisible to an INSERT.\n\t// UPDATE must delete the old value of the index but doesn't write\n\t// the new value. DELETE must delete the index.\n\t//\n\t// When deleting a descriptor, all descriptor related data\n\t// (column or index data) can only be mass deleted once\n\t// all the nodes have transitioned to the DELETE_ONLY state.\n\tDescriptorMutation_DELETE_ONLY DescriptorMutation_State = 1\n\t// Operations can use this invisible descriptor to implicitly\n\t// write and delete entries.\n\t// Column: INSERT will populate this column with the default\n\t// value. UPDATE ignores this descriptor. DELETE must delete\n\t// the column.\n\t// Index: INSERT, UPDATE and DELETE treat this index like any\n\t// other index.\n\t//\n\t// When adding a descriptor, all descriptor related data\n\t// (column default or index data) can only be backfilled once\n\t// all nodes have transitioned into the WRITE_ONLY state.\n\tDescriptorMutation_WRITE_ONLY DescriptorMutation_State = 2\n)\n```\n\n```go\nfunc (x DescriptorMutation_State) Enum() *DescriptorMutation_State\n```\n\n```go\nfunc (DescriptorMutation_State) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x DescriptorMutation_State) String() string\n```\n\n```go\nfunc (x *DescriptorMutation_State) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype DescriptorProto interface {\n\tproto.Message\n\tGetPrivileges() *PrivilegeDescriptor\n\tGetID() ID\n\tSetID(ID)\n\tTypeName() string\n\tGetName() string\n\tSetName(string)\n\tValidate() error\n}\n```\nDescriptorProto is the interface implemented by both DatabaseDescriptor and TableDescriptor. TODO(marc): this is getting rather large.\n\n```go\ntype DescriptorStatus int\n```\nDescriptorStatus is the status for a descriptor.\n\n```go\nconst (\n\n\t// DescriptorAbsent for a descriptor that doesn't exist.\n\tDescriptorAbsent DescriptorStatus\n\t// DescriptorIncomplete for a descriptor that is a part of a\n\t// schema change, and is still being processed.\n\tDescriptorIncomplete\n\t// DescriptorActive for a descriptor that is completely active\n\t// for read/write and delete operations.\n\tDescriptorActive\n)\n```\n\n```go\ntype DescriptorVersion uint32\n```\nDescriptorVersion is a custom type for TableDescriptor Versions.\n\n```go\ntype Descriptor_Database struct {\n\tDatabase *DatabaseDescriptor `protobuf:\"bytes,2,opt,name=database,oneof\"`\n}\n```\n\n```go\nfunc (m *Descriptor_Database) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *Descriptor_Database) Size() (n int)\n```\n\n```go\ntype Descriptor_Table struct {\n\tTable *TableDescriptor `protobuf:\"bytes,1,opt,name=table,oneof\"`\n}\n```\n\n```go\nfunc (m *Descriptor_Table) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (m *Descriptor_Table) Size() (n int)\n```\n\n```go\ntype EncDatum struct {\n\n\t// Decoded datum.\n\tDatum parser.Datum\n\t// contains filtered or unexported fields\n}\n```\nEncDatum represents a datum that is \"backed\" by an encoding and/or by a parser.Datum. It allows \"passing through\" a Datum without decoding and reencoding. TODO(radu): It will also allow comparing encoded datums directly (for certain encodings).\n\n```go\nfunc (ed *EncDatum) Decode(a *DatumAlloc) error\n```\nDecode ensures that Datum is set (decoding if necessary).\n\n```go\nfunc (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)\n```\nEncode appends the encoded datum to the given slice using the requested encoding.\n\n```go\nfunc (ed *EncDatum) Encoding() DatumEncoding\n```\nEncoding returns the encoding that is already available (NoEncoding if none).\n\n```go\nfunc (ed *EncDatum) IsUnset() bool\n```\nIsUnset returns true if SetEncoded or SetDatum were not called.\n\n```go\nfunc (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)\n```\nSetDatum initializes the EncDatum with the given Datum.\n\n```go\nfunc (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)\n```\nSetEncoded initializes the EncDatum with the given encoded value. The encoded value is stored as a shallow copy, so the caller must make sure the slice is not modified for the lifetime of the EncDatum.\n\n```go\ntype FormatVersion uint32\n```\nFormatVersion is a custom type for TableDescriptor versions of the sql to key:value mapping.\n\n```go\nconst (\n\n\t// BaseFormatVersion corresponds to the encoding described in\n\t// https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/.\n\tBaseFormatVersion FormatVersion\n)\n```\n\n```go\nfunc (i FormatVersion) String() string\n```\n\n```go\ntype ID uint32\n```\nID is a custom type for {Database,Table}Descriptor IDs.\n\n```go\ntype IndexDescriptor struct {\n\tName   string  `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID     IndexID `protobuf:\"varint,2,opt,name=id,casttype=IndexID\" json:\"id\"`\n\tUnique bool    `protobuf:\"varint,3,opt,name=unique\" json:\"unique\"`\n\t// An ordered list of column names of which the index is comprised. This list\n\t// parallels the column_ids list. If duplicating the storage of the column\n\t// names here proves to be prohibitive, we could clear this field before\n\t// saving and reconstruct it after loading.\n\tColumnNames []string `protobuf:\"bytes,4,rep,name=column_names,json=columnNames\" json:\"column_names,omitempty\"`\n\t// Parallel with column_names - the sort direction of each column.\n\tColumnDirections []IndexDescriptor_Direction `protobuf:\"varint,8,rep,name=column_directions,json=columnDirections,enum=cockroach.sql.sqlbase.IndexDescriptor_Direction\" json:\"column_directions,omitempty\"`\n\t// An ordered list of column names which the index stores in\n\t// addition to the columns which are explicitly part of the index.\n\tStoreColumnNames []string `protobuf:\"bytes,5,rep,name=store_column_names,json=storeColumnNames\" json:\"store_column_names,omitempty\"`\n\t// An ordered list of column ids of which the index is comprised. This list\n\t// parallels the column_names list.\n\tColumnIDs []ColumnID `protobuf:\"varint,6,rep,name=column_ids,json=columnIds,casttype=ColumnID\" json:\"column_ids,omitempty\"`\n\t// An ordered list of implicit column ids associated with the index. For\n\t// non-unique indexes, these columns will be appended to the key. For unique\n\t// indexes these columns will be stored in the value. The extra column IDs is\n\t// computed as PrimaryIndex.column_ids - column_ids. For the primary index\n\t// the list will be empty.\n\t// The distinction about whether the columns are written in the key or the value\n\t// comes because we want to always do writes using a single operation - this\n\t// way for unique indexes we can do a conditional put on the key.\n\tImplicitColumnIDs []ColumnID `protobuf:\"varint,7,rep,name=implicit_column_ids,json=implicitColumnIds,casttype=ColumnID\" json:\"implicit_column_ids,omitempty\"`\n}\n```\n\n```go\nfunc (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool\n```\nContainsColumnID returns true if the index descriptor contains the specified column ID either in its explicit column IDs or the implicit \"extra\" column IDs.\n\n```go\nfunc (*IndexDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error\n```\nFillColumns sets the column names and directions in desc.\n\n```go\nfunc (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)\n```\nFullColumnIDs returns the index column IDs including any implicit column IDs for non-unique indexes. It also returns the direction with which each column was encoded.\n\n```go\nfunc (m *IndexDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *IndexDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*IndexDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *IndexDescriptor) Reset()\n```\n\n```go\nfunc (m *IndexDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *IndexDescriptor) String() string\n```\n\n```go\nfunc (m *IndexDescriptor) Unmarshal(data []byte) error\n```\n\n```go\ntype IndexDescriptor_Direction int32\n```\nThe direction of a column in the index.\n\n```go\nconst (\n\tIndexDescriptor_ASC  IndexDescriptor_Direction = 0\n\tIndexDescriptor_DESC IndexDescriptor_Direction = 1\n)\n```\n\n```go\nfunc (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction\n```\n\n```go\nfunc (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x IndexDescriptor_Direction) String() string\n```\n\n```go\nfunc (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)\n```\nToEncodingDirection converts a direction from the proto to an encoding.Direction.\n\n```go\nfunc (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype IndexEntry struct {\n\tKey   roachpb.Key\n\tValue []byte\n}\n```\nIndexEntry represents an encoded key/value for an index entry.\n\n```go\nfunc EncodeSecondaryIndex(\n\ttableID ID,\n\tsecondaryIndex IndexDescriptor,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n) (IndexEntry, error)\n```\nEncodeSecondaryIndex encodes key/values for a secondary index. colMap maps ColumnIDs to indices in \\`values\\`.\n\n```go\nfunc EncodeSecondaryIndexes(\n\ttableID ID,\n\tindexes []IndexDescriptor,\n\tcolMap map[ColumnID]int,\n\tvalues []parser.Datum,\n) ([]IndexEntry, error)\n```\nEncodeSecondaryIndexes encodes key/values for the secondary indexes. colMap maps ColumnIDs to indices in \\`values\\`.\n\n```go\ntype IndexID uint32\n```\nIndexID is a custom type for IndexDescriptor IDs.\n\n```go\nfunc DecodeIndexKeyPrefix(desc *TableDescriptor, key []byte) (\n\tIndexID, []byte, error,\n)\n```\nDecodeIndexKeyPrefix decodes the prefix of an index key and returns the index id and a slice for the rest of the key.\n\n```go\ntype MetadataSchema struct {\n\t// contains filtered or unexported fields\n}\n```\nMetadataSchema is used to construct the initial sql schema for a new CockroachDB cluster being bootstrapped. Tables and databases must be installed on the underlying persistent storage before a cockroach store can start running correctly, thus requiring this special initialization.\n\n```go\nfunc MakeMetadataSchema() MetadataSchema\n```\nMakeMetadataSchema constructs a new MetadataSchema value which constructs the \"system\" database.\n\n```go\nfunc (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)\n```\nAddDescriptor adds a new descriptor to the system schema. Used only for SystemConfig tables and databases. Prefer AddTable for most uses.\n\n```go\nfunc (ms *MetadataSchema) AddTable(id ID, definition string, privileges privilege.List)\n```\nAddTable adds a new table to the system database.\n\n```go\nfunc (ms MetadataSchema) DescriptorCount() int\n```\nDescriptorCount returns the number of descriptors that will be created by this schema. This value is needed to automate certain tests.\n\n```go\nfunc (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue\n```\nGetInitialValues returns the set of initial K/V values which should be added to a bootstrapping CockroachDB cluster in order to create the tables contained in the schema.\n\n```go\nfunc (ms MetadataSchema) MaxTableID() ID\n```\nMaxTableID returns the highest table ID of any system table. This value is needed to automate certain tests.\n\n```go\nfunc (ms MetadataSchema) TableCount() int\n```\nTableCount returns the number of non-system config tables in the system database. This value is needed to automate certain tests.\n\n```go\ntype MutationID uint32\n```\nMutationID is custom type for TableDescriptor mutations.\n\n```go\nconst InvalidMutationID MutationID = 0\n```\nInvalidMutationID is the uninitialised mutation id.\n\n```go\ntype PrivilegeDescriptor struct {\n\tUsers []UserPrivileges `protobuf:\"bytes,1,rep,name=users\" json:\"users\"`\n}\n```\nPrivilegeDescriptor describes a list of users and attached privileges. The list should be sorted by user for fast access.\n\n```go\nfunc NewDefaultPrivilegeDescriptor() *PrivilegeDescriptor\n```\nNewDefaultPrivilegeDescriptor returns a privilege descriptor with ALL privileges for the root user.\n\n```go\nfunc NewPrivilegeDescriptor(user string, priv privilege.List) *PrivilegeDescriptor\n```\nNewPrivilegeDescriptor returns a privilege descriptor for the given user with the specified list of privileges.\n\n```go\nfunc (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool\n```\nCheckPrivilege returns true if 'user' has 'privilege' on this descriptor.\n\n```go\nfunc (*PrivilegeDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)\n```\nGrant adds new privileges to this descriptor for a given list of users. TODO(marc): if all privileges other than ALL are set, should we collapse them into ALL?\n\n```go\nfunc (m *PrivilegeDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*PrivilegeDescriptor) ProtoMessage()\n```\n\n```go\nfunc (m *PrivilegeDescriptor) Reset()\n```\n\n```go\nfunc (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)\n```\nRevoke removes privileges from this descriptor for a given list of users.\n\n```go\nfunc (p PrivilegeDescriptor) Show() []UserPrivilegeString\n```\nShow returns the list of {username, privileges} sorted by username. 'privileges' is a string of comma-separated sorted privilege names.\n\n```go\nfunc (m *PrivilegeDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *PrivilegeDescriptor) String() string\n```\n\n```go\nfunc (m *PrivilegeDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (p PrivilegeDescriptor) Validate(id ID) error\n```\nValidate is called when writing a database or table descriptor. It takes the descriptor ID which is used to determine if it belongs to a system descriptor, in which case the maximum set of allowed privileges is looked up and applied.\n\n```go\ntype RowFetcher struct {\n\t// contains filtered or unexported fields\n}\n```\nRowFetcher handles fetching kvs and forming table rows. Usage:\n\n\tvar rf RowFetcher\n\terr := rf.Init(..)\n\t// Handle err\n\terr := rf.StartScan(..)\n\t// Handle err\n\tfor {\n\t   row, err := rf.NextRow()\n\t   // Handle err\n\t   if row == nil {\n\t      // Done\n\t      break\n\t   }\n\t   // Process row\n\t}\n\n```go\nfunc (rf *RowFetcher) Init(\n\tdesc *TableDescriptor,\n\tcolIdxMap map[ColumnID]int,\n\tindex *IndexDescriptor,\n\treverse, isSecondaryIndex bool,\n\tvalNeededForCol []bool,\n) error\n```\nInit sets up a RowFetcher for a given table and index. If we are using a non-primary index, valNeededForCol can only be true for the columns in the index.\n\n```go\nfunc (rf *RowFetcher) Key() roachpb.Key\n```\nKey returns the next key (the key that follows the last returned row).\n\n```go\nfunc (rf *RowFetcher) NextKey() (rowDone bool, err error)\n```\nNextKey retrieves the next key/value and sets kv/kvEnd. Returns whether a row has been completed. TODO(andrei): change to return error\n\n```go\nfunc (rf *RowFetcher) NextKeyDebug() (\n\tprettyKey string, prettyValue string, row parser.DTuple, err error,\n)\n```\nNextKeyDebug processes one key at a time and returns a pretty printed key and value. If we completed a row, the row is returned as well (see nextRow). If there are no more keys, prettyKey is \"\".\n\n```go\nfunc (rf *RowFetcher) NextRow() (parser.DTuple, error)\n```\nNextRow processes keys until we complete one row, which is returned as a DTuple. The row contains one value per table column, regardless of the index used; values that are not needed (as per valNeededForCol) are nil.\n\nThe DTuple should not be modified and is only valid until the next call. When there are no more rows, the DTuple is nil.\n\n```go\nfunc (rf *RowFetcher) ProcessKV(kv client.KeyValue, debugStrings bool) (\n\tprettyKey string, prettyValue string, err error,\n)\n```\nProcessKV processes the given key/value, setting values in the row accordingly. If debugStrings is true, returns pretty printed key and value information in prettyKey/prettyValue (otherwise they are empty strings).\n\n```go\nfunc (rf *RowFetcher) ReadIndexKey(k roachpb.Key) (remaining []byte, err error)\n```\nReadIndexKey decodes an index key for the fetcher's table.\n\n```go\nfunc (rf *RowFetcher) StartScan(txn *client.Txn, spans Spans, limitHint int64) error\n```\nStartScan initializes and starts the key-value scan. Can be used multiple times.\n\n```go\ntype Span struct {\n\tStart roachpb.Key // inclusive key\n\tEnd   roachpb.Key // exclusive key\n\tCount int64       // max # of keys for this span\n}\n```\nSpan represents a span that is part of a scan.\n\n```go\ntype Spans []Span\n```\nSpans is a slice of spans.\n\n```go\nfunc (a Spans) Len() int\n```\nimplement Sort.Interface\n\n```go\nfunc (a Spans) Less(i, j int) bool\n```\n\n```go\nfunc (a Spans) Swap(i, j int)\n```\n\n```go\ntype TableDescriptor struct {\n\t// The table name. It should be normalized using sqlbase.NormalizeName()\n\t// before comparing it.\n\tName string `protobuf:\"bytes,1,opt,name=name\" json:\"name\"`\n\tID   ID     `protobuf:\"varint,3,opt,name=id,casttype=ID\" json:\"id\"`\n\t// ID of the parent database.\n\tParentID ID `protobuf:\"varint,4,opt,name=parent_id,json=parentId,casttype=ID\" json:\"parent_id\"`\n\t// Monotonically increasing version of the table descriptor.\n\t//\n\t// Invariants:\n\t// 1. not more than two subsequent versions of the table\n\t// descriptor can be leased. This is to make the system\n\t// easy to reason about, by permiting mutation state\n\t// changes (reflected in the next version), only when the existing\n\t// state (reflected in the current version) is present on all\n\t// outstanding unexpired leases.\n\t// 2. A schema change command (ALTER, RENAME, etc) never directly\n\t// increments the version. This allows the command to execute without\n\t// waiting for the entire cluster to converge to a single version\n\t// preventing weird deadlock situations. For instance, a transaction\n\t// with a schema change command might use a descriptor lease that is\n\t// at version: v - 1, and therefore deadlock when it tries to wait\n\t// for version: v, in the process of incrementing it to v + 1.\n\t// Therefore, a schema change command never increments the version,\n\t// and instead, sets the up_version boolean to notify the schema\n\t// changer execution engine that runs a future transaction to\n\t// increment the version.\n\t//\n\t// The schema change commands must therefore make *safe* modifications\n\t// to the table descriptor, such as scheduling long running schema\n\t// changes through mutations for future execution, or making simple\n\t// schema changes like RENAME that only modify the table descriptor in a\n\t// single transaction.\n\t//\n\t// Multiple schema changes in the same transaction set up_version.\n\t// The actual schema change execution that follows a schema change\n\t// command sees the up_version boolean set, and increments the\n\t// table version after ensuring that there are no unexpired leases\n\t// for version - 1. The schema change execution must increment\n\t// the version before executing future state changes, to ensure\n\t// that the scheduled mutations made by the original commands are\n\t// visible on all leases. Multiple schema change mutations can be\n\t// grouped together on a particular version increment.\n\t//\n\t// If schema change commands are safe to run without incrementing\n\t// the version, why do it later on? We increment the version\n\t// to ensure that all the nodes renew their leases with the new version\n\t// and get to see what the schema change command has done quickly.\n\tVersion DescriptorVersion `protobuf:\"varint,5,opt,name=version,casttype=DescriptorVersion\" json:\"version\"`\n\t// See comment above.\n\tUpVersion bool `protobuf:\"varint,6,opt,name=up_version,json=upVersion\" json:\"up_version\"`\n\t// Last modification time of the table descriptor.\n\tModificationTime cockroach_roachpb1.Timestamp `protobuf:\"bytes,7,opt,name=modification_time,json=modificationTime\" json:\"modification_time\"`\n\tColumns          []ColumnDescriptor           `protobuf:\"bytes,8,rep,name=columns\" json:\"columns\"`\n\t// next_column_id is used to ensure that deleted column ids are not reused.\n\tNextColumnID ColumnID        `protobuf:\"varint,9,opt,name=next_column_id,json=nextColumnId,casttype=ColumnID\" json:\"next_column_id\"`\n\tPrimaryIndex IndexDescriptor `protobuf:\"bytes,10,opt,name=primary_index,json=primaryIndex\" json:\"primary_index\"`\n\t// indexes are all the secondary indexes.\n\tIndexes []IndexDescriptor `protobuf:\"bytes,11,rep,name=indexes\" json:\"indexes\"`\n\t// next_index_id is used to ensure that deleted index ids are not reused.\n\tNextIndexID IndexID              `protobuf:\"varint,12,opt,name=next_index_id,json=nextIndexId,casttype=IndexID\" json:\"next_index_id\"`\n\tPrivileges  *PrivilegeDescriptor `protobuf:\"bytes,13,opt,name=privileges\" json:\"privileges,omitempty\"`\n\t// Columns or indexes being added or deleted in a FIFO order.\n\tMutations []DescriptorMutation               `protobuf:\"bytes,14,rep,name=mutations\" json:\"mutations\"`\n\tLease     *TableDescriptor_SchemaChangeLease `protobuf:\"bytes,15,opt,name=lease\" json:\"lease,omitempty\"`\n\t// An id for the next group of mutations to be applied together.\n\tNextMutationID MutationID `protobuf:\"varint,16,opt,name=next_mutation_id,json=nextMutationId,casttype=MutationID\" json:\"next_mutation_id\"`\n\t// format_version declares which sql to key:value mapping is being used to\n\t// represent the data in this table.\n\tFormatVersion FormatVersion                      `protobuf:\"varint,17,opt,name=format_version,json=formatVersion,casttype=FormatVersion\" json:\"format_version\"`\n\tState         TableDescriptor_State              `protobuf:\"varint,19,opt,name=state,enum=cockroach.sql.sqlbase.TableDescriptor_State\" json:\"state\"`\n\tChecks        []*TableDescriptor_CheckConstraint `protobuf:\"bytes,20,rep,name=checks\" json:\"checks,omitempty\"`\n\t// This array is populated if the descriptor was renamed. If the descriptor is\n\t// renamed multiple times before the schema chage is processed, there will be\n\t// one element for each rename.\n\t// When this is detected in a schema change, the records for the old names are\n\t// deleted and this field is cleared.\n\tRenames []TableDescriptor_RenameInfo `protobuf:\"bytes,21,rep,name=renames\" json:\"renames\"`\n}\n```\nA TableDescriptor represents a table 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.\n\n```go\nfunc GetTableDescriptor(kvDB *client.DB, database string, table string) *TableDescriptor\n```\nGetTableDescriptor retrieves a table descriptor directly from the KV layer.\n\n```go\nfunc MakeTableDesc(p *parser.CreateTable, parentID ID) (TableDescriptor, error)\n```\nMakeTableDesc creates a table descriptor from a CreateTable statement.\n\n```go\nfunc (desc *TableDescriptor) AddColumn(col ColumnDescriptor)\n```\nAddColumn adds a column to the table.\n\n```go\nfunc (desc *TableDescriptor) AddColumnMutation(c ColumnDescriptor, direction DescriptorMutation_Direction)\n```\nAddColumnMutation adds a column mutation to desc.Mutations.\n\n```go\nfunc (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error\n```\nAddIndex adds an index to the table.\n\n```go\nfunc (desc *TableDescriptor) AddIndexMutation(idx IndexDescriptor, direction DescriptorMutation_Direction)\n```\nAddIndexMutation adds an index mutation to desc.Mutations.\n\n```go\nfunc (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor\n```\nAllNonDropIndexes returns all the indexes, including those being added in the mutations.\n\n```go\nfunc (desc *TableDescriptor) AllocateIDs() error\n```\nAllocateIDs allocates column and index ids for any column or index which has an ID of 0.\n\n```go\nfunc (desc *TableDescriptor) Deleted() bool\n```\nDeleted returns true if the table is being deleted.\n\n```go\nfunc (*TableDescriptor) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (desc *TableDescriptor) FinalizeMutation() (MutationID, error)\n```\nFinalizeMutation returns the id that has been used by mutations appended with addMutation() since the last time this function was called. Future mutations will use a new ID.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)\n```\nFindActiveColumnByID finds the active column with specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindActiveColumnByName(name string) (ColumnDescriptor, error)\n```\nFindActiveColumnByName finds an active column with the specified name.\n\n```go\nfunc (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)\n```\nFindColumnByID finds the column with specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindColumnByName(name string) (DescriptorStatus, int, error)\n```\nFindColumnByName finds the column with the specified name. It returns DescriptorStatus for the column, and an index into either the columns (status == DescriptorActive) or mutations (status == DescriptorIncomplete).\n\n```go\nfunc (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)\n```\nFindIndexByID finds an index (active or inactive) with the specified ID.\n\n```go\nfunc (desc *TableDescriptor) FindIndexByName(name string) (DescriptorStatus, int, error)\n```\nFindIndexByName finds the index with the specified name. It returns DescriptorStatus for the index, and an index into either the indexes (status == DescriptorActive) or mutations (status == DescriptorIncomplete).\n\n```go\nfunc (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint\n```\n\n```go\nfunc (m *TableDescriptor) GetColumns() []ColumnDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetFormatVersion() FormatVersion\n```\n\n```go\nfunc (m *TableDescriptor) GetID() ID\n```\n\n```go\nfunc (m *TableDescriptor) GetIndexes() []IndexDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease\n```\n\n```go\nfunc (m *TableDescriptor) GetModificationTime() cockroach_roachpb1.Timestamp\n```\n\n```go\nfunc (m *TableDescriptor) GetMutations() []DescriptorMutation\n```\n\n```go\nfunc (m *TableDescriptor) GetName() string\n```\n\n```go\nfunc (m *TableDescriptor) GetNextColumnID() ColumnID\n```\n\n```go\nfunc (m *TableDescriptor) GetNextIndexID() IndexID\n```\n\n```go\nfunc (m *TableDescriptor) GetNextMutationID() MutationID\n```\n\n```go\nfunc (m *TableDescriptor) GetParentID() ID\n```\n\n```go\nfunc (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor\n```\n\n```go\nfunc (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo\n```\n\n```go\nfunc (m *TableDescriptor) GetState() TableDescriptor_State\n```\n\n```go\nfunc (m *TableDescriptor) GetUpVersion() bool\n```\n\n```go\nfunc (m *TableDescriptor) GetVersion() DescriptorVersion\n```\n\n```go\nfunc (desc *TableDescriptor) IsEmpty() bool\n```\nIsEmpty checks if the descriptor is uninitialized.\n\n```go\nfunc (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)\n```\nMakeMutationComplete updates the descriptor upon completion of a mutation.\n\n```go\nfunc (m *TableDescriptor) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor) ProtoMessage()\n```\n\n```go\nfunc (desc *TableDescriptor) Renamed() bool\n```\nRenamed returns true if the table is being renamed.\n\n```go\nfunc (m *TableDescriptor) Reset()\n```\n\n```go\nfunc (desc *TableDescriptor) SetID(id ID)\n```\nSetID implements the DescriptorProto interface.\n\n```go\nfunc (desc *TableDescriptor) SetName(name string)\n```\nSetName implements the DescriptorProto interface.\n\n```go\nfunc (desc *TableDescriptor) SetUpVersion() error\n```\nSetUpVersion sets the up\\_version marker on the table descriptor (see the proto\n\n```go\nfunc (m *TableDescriptor) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor) String() string\n```\n\n```go\nfunc (desc *TableDescriptor) TypeName() string\n```\nTypeName returns the plain type of this descriptor.\n\n```go\nfunc (m *TableDescriptor) Unmarshal(data []byte) error\n```\n\n```go\nfunc (desc *TableDescriptor) Validate() error\n```\nValidate validates that the table descriptor is well formed. Checks include validating the table, column and index names, verifying that column names and index names are unique and verifying that column IDs and index IDs are consistent.\n\n```go\nfunc (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor\n```\nVisibleColumns returns all non hidden columns.\n\n```go\ntype TableDescriptor_CheckConstraint struct {\n\tExpr string `protobuf:\"bytes,1,opt,name=expr\" json:\"expr\"`\n\tName string `protobuf:\"bytes,2,opt,name=name\" json:\"name\"`\n}\n```\n\n```go\nfunc (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_CheckConstraint) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) String() string\n```\n\n```go\nfunc (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_RenameInfo struct {\n\t// The database that the table belonged to before the rename (tables can be\n\t// renamed from one db to another).\n\tOldParentID uint32 `protobuf:\"varint,1,opt,name=old_parent_id,json=oldParentId\" json:\"old_parent_id\"`\n\tOldName     string `protobuf:\"bytes,2,opt,name=old_name,json=oldName\" json:\"old_name\"`\n}\n```\n\n```go\nfunc (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_RenameInfo) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) String() string\n```\n\n```go\nfunc (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_SchemaChangeLease struct {\n\tNodeID github_com_cockroachdb_cockroach_roachpb.NodeID `protobuf:\"varint,1,opt,name=node_id,json=nodeId,casttype=github.com/cockroachdb/cockroach/roachpb.NodeID\" json:\"node_id\"`\n\t// Nanoseconds since the Unix epoch.\n\tExpirationTime int64 `protobuf:\"varint,2,opt,name=expiration_time,json=expirationTime\" json:\"expiration_time\"`\n}\n```\nThe 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.\n\n```go\nfunc (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*TableDescriptor_SchemaChangeLease) ProtoMessage()\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Reset()\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Size() (n int)\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) String() string\n```\n\n```go\nfunc (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error\n```\n\n```go\ntype TableDescriptor_State int32\n```\nState 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.\n\n```go\nconst (\n\t// Not used.\n\tTableDescriptor_PUBLIC TableDescriptor_State = 0\n\t// Descriptor is being added.\n\t// ADD = 1;\n\t// Descriptor is being dropped.\n\tTableDescriptor_DROP TableDescriptor_State = 2\n)\n```\n\n```go\nfunc (x TableDescriptor_State) Enum() *TableDescriptor_State\n```\n\n```go\nfunc (TableDescriptor_State) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (x TableDescriptor_State) String() string\n```\n\n```go\nfunc (x *TableDescriptor_State) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype UserPrivilegeString struct {\n\tUser       string\n\tPrivileges string\n}\n```\nUserPrivilegeString is a pair of strings describing the privileges for a given user.\n\n```go\ntype UserPrivileges struct {\n\tUser string `protobuf:\"bytes,1,opt,name=user\" json:\"user\"`\n\t// privileges is a bitfield of 1\u003c\u003cPrivilege values.\n\tPrivileges uint32 `protobuf:\"varint,2,opt,name=privileges\" json:\"privileges\"`\n}\n```\nUserPrivileges describes the list of privileges available for a given user.\n\n```go\nfunc (*UserPrivileges) Descriptor() ([]byte, []int)\n```\n\n```go\nfunc (m *UserPrivileges) Marshal() (data []byte, err error)\n```\n\n```go\nfunc (m *UserPrivileges) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (*UserPrivileges) ProtoMessage()\n```\n\n```go\nfunc (m *UserPrivileges) Reset()\n```\n\n```go\nfunc (m *UserPrivileges) Size() (n int)\n```\n\n```go\nfunc (m *UserPrivileges) String() string\n```\n\n```go\nfunc (m *UserPrivileges) Unmarshal(data []byte) error\n```\n\n","path":"github.com/tescherm/cockroach/sql/sqlbase","name":"sqlbase","synopsis":"Package sqlbase is a generated protocol buffer package.","isRedistributable":true}
