Documentation ¶
Overview ¶
Package sqlbase is a generated protocol buffer package.
It is generated from these files:
cockroach/sql/sqlbase/backup.proto cockroach/sql/sqlbase/encoded_datum.proto cockroach/sql/sqlbase/privilege.proto cockroach/sql/sqlbase/structured.proto
It has these top-level messages:
BackupRangeDescriptor BackupDescriptor UserPrivileges PrivilegeDescriptor ColumnType ForeignKeyReference ColumnDescriptor ColumnFamilyDescriptor InterleaveDescriptor IndexDescriptor DescriptorMutation TableDescriptor DatabaseDescriptor Descriptor
Index ¶
- Constants
- Variables
- func CheckColumnType(col ColumnDescriptor, val parser.Datum, pmap *parser.PlaceholderInfo) error
- func CheckValueWidth(col ColumnDescriptor, val parser.Datum) error
- func ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs
- func DecodeIndexKey(a *DatumAlloc, desc *TableDescriptor, indexID IndexID, ...) ([]byte, bool, error)
- func DecodeKeyVals(a *DatumAlloc, valTypes, vals []parser.Datum, directions []encoding.Direction, ...) ([]byte, error)
- func DecodeTableIDIndexID(key []byte) ([]byte, ID, IndexID, error)
- func DecodeTableKey(a *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction) (parser.Datum, []byte, error)
- func DecodeTableValue(a *DatumAlloc, valType parser.Datum, b []byte) (parser.Datum, []byte, error)
- func EncodeColumns(columnIDs []ColumnID, directions directions, colMap map[ColumnID]int, ...) (key []byte, containsNull bool, err error)
- func EncodeDTuple(b []byte, d parser.DTuple) ([]byte, error)
- func EncodeDatum(b []byte, d parser.Datum) ([]byte, error)
- func EncodeIndexKey(tableDesc *TableDescriptor, index *IndexDescriptor, colMap map[ColumnID]int, ...) (key []byte, containsNull bool, err error)
- func EncodeSecondaryIndexes(tableDesc *TableDescriptor, indexes []IndexDescriptor, colMap map[ColumnID]int, ...) error
- func EncodeTableKey(b []byte, val parser.Datum, dir encoding.Direction) ([]byte, error)
- func EncodeTableValue(appendTo []byte, colID ColumnID, val parser.Datum) ([]byte, error)
- func EqualName(a, b parser.Name) bool
- func ExtractIndexKey(a *DatumAlloc, tableDesc *TableDescriptor, entry client.KeyValue) (roachpb.Key, error)
- func IsIntegrityConstraintError(err error) bool
- func IsSystemConfigID(id ID) bool
- func MakeAllDescsMetadataKey() roachpb.Key
- func MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)
- func MakeDescMetadataKey(descID ID) roachpb.Key
- func MakeIndexKeyPrefix(desc *TableDescriptor, indexID IndexID) []byte
- func MakeKeyFromEncDatums(values EncDatumRow, directions []IndexDescriptor_Direction, keyPrefix []byte, ...) (key roachpb.Key, err error)
- func MakeKeyVals(desc *TableDescriptor, columnIDs []ColumnID) ([]parser.Datum, error)
- func MakeNameMetadataKey(parentID ID, name string) roachpb.Key
- func MakeZoneKey(id ID) roachpb.Key
- func MarshalColumnValue(col ColumnDescriptor, val parser.Datum) (roachpb.Value, error)
- func NewDatabaseAlreadyExistsError(name string) error
- func NewNonNullViolationError(columnName string) error
- func NewRelationAlreadyExistsError(name string) error
- func NewRetryError(cause error) error
- func NewSyntaxError(msg string) error
- func NewTransactionAbortedError(customMsg string) error
- func NewTransactionCommittedError() error
- func NewUndefinedDatabaseError(name string) error
- func NewUndefinedTableError(name string) error
- func NewUndefinedViewError(name string) error
- func NewUniquenessConstraintViolationError(index *IndexDescriptor, vals []parser.Datum) error
- func NewWrongObjectTypeError(name, desiredObjType string) error
- func NormalizeName(name parser.Name) string
- func NormalizeTableName(tn parser.TableName) parser.TableName
- func PrettySpan(span roachpb.Span, skip int) string
- func PrettySpans(spans []roachpb.Span, skip int) string
- func RandDatum(rng *rand.Rand, typ ColumnType_Kind, null bool) parser.Datum
- func RandEncDatumSlices(rng *rand.Rand, numSets, numValsPerSet int) [][]EncDatum
- func ReNormalizeName(name string) string
- func RunFilter(filter parser.TypedExpr, evalCtx *parser.EvalContext) (bool, error)
- func SanitizeVarFreeExpr(expr parser.Expr, expectedType parser.Datum, context string) error
- func SetKVBatchSize(val int64) func()
- func UnmarshalColumnValue(a *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value) (parser.Datum, error)
- type BackupDescriptor
- func (*BackupDescriptor) Descriptor() ([]byte, []int)
- func (m *BackupDescriptor) Marshal() (data []byte, err error)
- func (m *BackupDescriptor) MarshalTo(data []byte) (int, error)
- func (*BackupDescriptor) ProtoMessage()
- func (m *BackupDescriptor) Reset()
- func (m *BackupDescriptor) Size() (n int)
- func (m *BackupDescriptor) String() string
- func (m *BackupDescriptor) Unmarshal(data []byte) error
- type BackupRangeDescriptor
- func (*BackupRangeDescriptor) Descriptor() ([]byte, []int)
- func (m *BackupRangeDescriptor) Marshal() (data []byte, err error)
- func (m *BackupRangeDescriptor) MarshalTo(data []byte) (int, error)
- func (*BackupRangeDescriptor) ProtoMessage()
- func (m *BackupRangeDescriptor) Reset()
- func (m *BackupRangeDescriptor) Size() (n int)
- func (m *BackupRangeDescriptor) String() string
- func (m *BackupRangeDescriptor) Unmarshal(data []byte) error
- type ColumnDescriptor
- func (*ColumnDescriptor) Descriptor() ([]byte, []int)
- func (m *ColumnDescriptor) Marshal() (data []byte, err error)
- func (m *ColumnDescriptor) MarshalTo(data []byte) (int, error)
- func (*ColumnDescriptor) ProtoMessage()
- func (m *ColumnDescriptor) Reset()
- func (m *ColumnDescriptor) Size() (n int)
- func (m *ColumnDescriptor) String() string
- func (m *ColumnDescriptor) Unmarshal(data []byte) error
- type ColumnFamilyDescriptor
- func (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int)
- func (m *ColumnFamilyDescriptor) Marshal() (data []byte, err error)
- func (m *ColumnFamilyDescriptor) MarshalTo(data []byte) (int, error)
- func (*ColumnFamilyDescriptor) ProtoMessage()
- func (m *ColumnFamilyDescriptor) Reset()
- func (m *ColumnFamilyDescriptor) Size() (n int)
- func (m *ColumnFamilyDescriptor) String() string
- func (m *ColumnFamilyDescriptor) Unmarshal(data []byte) error
- type ColumnID
- type ColumnOrderInfo
- type ColumnOrdering
- type ColumnType
- func (*ColumnType) Descriptor() ([]byte, []int)
- func (m *ColumnType) Marshal() (data []byte, err error)
- func (m *ColumnType) MarshalTo(data []byte) (int, error)
- func (c *ColumnType) MaxCharacterLength() (int32, bool)
- func (c *ColumnType) MaxOctetLength() (int32, bool)
- func (c *ColumnType) NumericPrecision() (int32, bool)
- func (c *ColumnType) NumericScale() (int32, bool)
- func (*ColumnType) ProtoMessage()
- func (m *ColumnType) Reset()
- func (c *ColumnType) SQLString() string
- func (m *ColumnType) Size() (n int)
- func (m *ColumnType) String() string
- func (c *ColumnType) ToDatumType() parser.Datum
- func (m *ColumnType) Unmarshal(data []byte) error
- type ColumnType_Kind
- type ConstraintDetail
- type ConstraintType
- type ConstraintValidity
- type DatabaseDescriptor
- func (*DatabaseDescriptor) Descriptor() ([]byte, []int)
- func (m *DatabaseDescriptor) GetID() ID
- func (m *DatabaseDescriptor) GetName() string
- func (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor
- func (m *DatabaseDescriptor) Marshal() (data []byte, err error)
- func (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)
- func (*DatabaseDescriptor) ProtoMessage()
- func (m *DatabaseDescriptor) Reset()
- func (desc *DatabaseDescriptor) SetID(id ID)
- func (desc *DatabaseDescriptor) SetName(name string)
- func (m *DatabaseDescriptor) Size() (n int)
- func (m *DatabaseDescriptor) String() string
- func (desc *DatabaseDescriptor) TypeName() string
- func (m *DatabaseDescriptor) Unmarshal(data []byte) error
- func (desc *DatabaseDescriptor) Validate() error
- type DatumAlloc
- func (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes
- func (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate
- func (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal
- func (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat
- func (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt
- func (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval
- func (a *DatumAlloc) NewDString(v parser.DString) *parser.DString
- func (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp
- func (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ
- type DatumEncoding
- type Descriptor
- func (*Descriptor) Descriptor() ([]byte, []int)
- func (m *Descriptor) GetDatabase() *DatabaseDescriptor
- func (desc *Descriptor) GetID() ID
- func (desc *Descriptor) GetName() string
- func (m *Descriptor) GetTable() *TableDescriptor
- func (m *Descriptor) GetUnion() isDescriptor_Union
- func (m *Descriptor) Marshal() (data []byte, err error)
- func (m *Descriptor) MarshalTo(data []byte) (int, error)
- func (*Descriptor) ProtoMessage()
- func (m *Descriptor) Reset()
- func (m *Descriptor) Size() (n int)
- func (m *Descriptor) String() string
- func (m *Descriptor) Unmarshal(data []byte) error
- func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type DescriptorKey
- type DescriptorMutation
- func (*DescriptorMutation) Descriptor() ([]byte, []int)
- func (m *DescriptorMutation) GetColumn() *ColumnDescriptor
- func (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_
- func (m *DescriptorMutation) GetIndex() *IndexDescriptor
- func (m *DescriptorMutation) Marshal() (data []byte, err error)
- func (m *DescriptorMutation) MarshalTo(data []byte) (int, error)
- func (*DescriptorMutation) ProtoMessage()
- func (m *DescriptorMutation) Reset()
- func (m *DescriptorMutation) Size() (n int)
- func (m *DescriptorMutation) String() string
- func (m *DescriptorMutation) Unmarshal(data []byte) error
- func (*DescriptorMutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type DescriptorMutation_Column
- type DescriptorMutation_Direction
- type DescriptorMutation_Index
- type DescriptorMutation_State
- type DescriptorProto
- type DescriptorStatus
- type DescriptorVersion
- type Descriptor_Database
- type Descriptor_Table
- type EncDatum
- func (ed *EncDatum) Compare(a *DatumAlloc, rhs *EncDatum) (int, error)
- func (ed *EncDatum) Decode(a *DatumAlloc) error
- func (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)
- func (ed *EncDatum) Encoding() (DatumEncoding, bool)
- func (ed *EncDatum) IsUnset() bool
- func (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)
- func (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)
- func (ed *EncDatum) SetFromBuffer(typ ColumnType_Kind, enc DatumEncoding, buf []byte) (remaining []byte, err error)
- func (ed *EncDatum) String() string
- type EncDatumRow
- type EncDatumRowAlloc
- type EncDatumRows
- type ErrDatabaseAlreadyExists
- type ErrNonNullViolation
- type ErrRelationAlreadyExists
- type ErrRetry
- type ErrSyntax
- type ErrTransactionAborted
- type ErrTransactionCommitted
- type ErrUndefinedDatabase
- type ErrUndefinedTable
- type ErrUniquenessConstraintViolation
- type ErrWrongObjectType
- type ErrorWithPGCode
- type FamilyID
- type ForeignKeyReference
- func (*ForeignKeyReference) Descriptor() ([]byte, []int)
- func (f ForeignKeyReference) IsSet() bool
- func (m *ForeignKeyReference) Marshal() (data []byte, err error)
- func (m *ForeignKeyReference) MarshalTo(data []byte) (int, error)
- func (*ForeignKeyReference) ProtoMessage()
- func (m *ForeignKeyReference) Reset()
- func (m *ForeignKeyReference) Size() (n int)
- func (m *ForeignKeyReference) String() string
- func (m *ForeignKeyReference) Unmarshal(data []byte) error
- type FormatVersion
- type ID
- type IndexDescriptor
- func (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool
- func (*IndexDescriptor) Descriptor() ([]byte, []int)
- func (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error
- func (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)
- func (m *IndexDescriptor) Marshal() (data []byte, err error)
- func (m *IndexDescriptor) MarshalTo(data []byte) (int, error)
- func (*IndexDescriptor) ProtoMessage()
- func (m *IndexDescriptor) Reset()
- func (m *IndexDescriptor) Size() (n int)
- func (m *IndexDescriptor) String() string
- func (m *IndexDescriptor) Unmarshal(data []byte) error
- type IndexDescriptor_Direction
- func (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction
- func (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)
- func (x IndexDescriptor_Direction) String() string
- func (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)
- func (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error
- type IndexEntry
- type IndexID
- type InterleaveDescriptor
- func (*InterleaveDescriptor) Descriptor() ([]byte, []int)
- func (m *InterleaveDescriptor) Marshal() (data []byte, err error)
- func (m *InterleaveDescriptor) MarshalTo(data []byte) (int, error)
- func (*InterleaveDescriptor) ProtoMessage()
- func (m *InterleaveDescriptor) Reset()
- func (m *InterleaveDescriptor) Size() (n int)
- func (m *InterleaveDescriptor) String() string
- func (m *InterleaveDescriptor) Unmarshal(data []byte) error
- type InterleaveDescriptor_Ancestor
- func (*InterleaveDescriptor_Ancestor) Descriptor() ([]byte, []int)
- func (m *InterleaveDescriptor_Ancestor) Marshal() (data []byte, err error)
- func (m *InterleaveDescriptor_Ancestor) MarshalTo(data []byte) (int, error)
- func (*InterleaveDescriptor_Ancestor) ProtoMessage()
- func (m *InterleaveDescriptor_Ancestor) Reset()
- func (m *InterleaveDescriptor_Ancestor) Size() (n int)
- func (m *InterleaveDescriptor_Ancestor) String() string
- func (m *InterleaveDescriptor_Ancestor) Unmarshal(data []byte) error
- type MetadataSchema
- func (ms *MetadataSchema) AddConfigDescriptor(parentID ID, desc DescriptorProto)
- func (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)
- func (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue
- func (ms MetadataSchema) SystemConfigDescriptorCount() int
- func (ms MetadataSchema) SystemDescriptorCount() int
- type MutationID
- type PrivilegeDescriptor
- func (p PrivilegeDescriptor) AnyPrivilege(user string) bool
- func (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool
- func (*PrivilegeDescriptor) Descriptor() ([]byte, []int)
- func (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)
- func (m *PrivilegeDescriptor) Marshal() (data []byte, err error)
- func (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)
- func (*PrivilegeDescriptor) ProtoMessage()
- func (m *PrivilegeDescriptor) Reset()
- func (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)
- func (p PrivilegeDescriptor) Show() []UserPrivilegeString
- func (m *PrivilegeDescriptor) Size() (n int)
- func (m *PrivilegeDescriptor) String() string
- func (m *PrivilegeDescriptor) Unmarshal(data []byte) error
- func (p PrivilegeDescriptor) Validate(id ID) error
- type RowFetcher
- func (rf *RowFetcher) Init(desc *TableDescriptor, colIdxMap map[ColumnID]int, index *IndexDescriptor, ...) error
- func (rf *RowFetcher) Key() roachpb.Key
- func (rf *RowFetcher) NextKey() (rowDone bool, err error)
- func (rf *RowFetcher) NextKeyDebug() (prettyKey string, prettyValue string, row parser.DTuple, err error)
- func (rf *RowFetcher) NextRow() (parser.DTuple, error)
- func (rf *RowFetcher) ProcessKV(kv client.KeyValue, debugStrings bool) (prettyKey string, prettyValue string, err error)
- func (rf *RowFetcher) ReadIndexKey(k roachpb.Key) (remaining []byte, ok bool, err error)
- func (rf *RowFetcher) StartScan(txn *client.Txn, spans roachpb.Spans, limitBatches bool, limitHint int64) error
- type SrcCtx
- type TableDescriptor
- func (desc *TableDescriptor) AddColumn(col ColumnDescriptor)
- func (desc *TableDescriptor) AddColumnMutation(c ColumnDescriptor, direction DescriptorMutation_Direction)
- func (desc *TableDescriptor) AddColumnToFamilyMaybeCreate(col string, family string, create bool, ifNotExists bool) error
- func (desc *TableDescriptor) AddFamily(fam ColumnFamilyDescriptor)
- func (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error
- func (desc *TableDescriptor) AddIndexMutation(idx IndexDescriptor, direction DescriptorMutation_Direction)
- func (desc *TableDescriptor) Adding() bool
- func (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor
- func (desc *TableDescriptor) AllocateIDs() error
- func (desc TableDescriptor) CheckUniqueConstraints() error
- func (desc *TableDescriptor) Deleted() bool
- func (*TableDescriptor) Descriptor() ([]byte, []int)
- func (desc *TableDescriptor) FinalizeMutation() (MutationID, error)
- func (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)
- func (desc *TableDescriptor) FindActiveColumnByName(name parser.Name) (ColumnDescriptor, error)
- func (desc *TableDescriptor) FindActiveColumnByNormalizedName(normName string) (ColumnDescriptor, error)
- func (desc *TableDescriptor) FindActiveColumnsByNames(names parser.NameList) ([]ColumnDescriptor, error)
- func (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)
- func (desc *TableDescriptor) FindColumnByName(name parser.Name) (DescriptorStatus, int, error)
- func (desc *TableDescriptor) FindColumnByNormalizedName(normName string) (DescriptorStatus, int, error)
- func (desc *TableDescriptor) FindFamilyByID(id FamilyID) (*ColumnFamilyDescriptor, error)
- func (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)
- func (desc *TableDescriptor) FindIndexByName(name parser.Name) (DescriptorStatus, int, error)
- func (desc *TableDescriptor) FindIndexByNormalizedName(normName string) (DescriptorStatus, int, error)
- func (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint
- func (m *TableDescriptor) GetColumns() []ColumnDescriptor
- func (desc TableDescriptor) GetConstraintInfo(txn *client.Txn) (map[string]ConstraintDetail, error)
- func (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor
- func (m *TableDescriptor) GetFormatVersion() FormatVersion
- func (m *TableDescriptor) GetID() ID
- func (m *TableDescriptor) GetIndexes() []IndexDescriptor
- func (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease
- func (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp
- func (m *TableDescriptor) GetMutations() []DescriptorMutation
- func (m *TableDescriptor) GetName() string
- func (m *TableDescriptor) GetNextColumnID() ColumnID
- func (m *TableDescriptor) GetNextFamilyID() FamilyID
- func (m *TableDescriptor) GetNextIndexID() IndexID
- func (m *TableDescriptor) GetNextMutationID() MutationID
- func (m *TableDescriptor) GetParentID() ID
- func (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor
- func (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor
- func (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo
- func (m *TableDescriptor) GetState() TableDescriptor_State
- func (m *TableDescriptor) GetUpVersion() bool
- func (m *TableDescriptor) GetVersion() DescriptorVersion
- func (m *TableDescriptor) GetViewQuery() string
- func (desc *TableDescriptor) IsEmpty() bool
- func (desc *TableDescriptor) IsInterleaved() bool
- func (desc *TableDescriptor) IsPhysicalTable() bool
- func (desc *TableDescriptor) IsTable() bool
- func (desc *TableDescriptor) IsView() bool
- func (desc *TableDescriptor) IsVirtualTable() bool
- func (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)
- func (m *TableDescriptor) Marshal() (data []byte, err error)
- func (m *TableDescriptor) MarshalTo(data []byte) (int, error)
- func (desc *TableDescriptor) MaybeUpgradeFormatVersion() bool
- func (*TableDescriptor) ProtoMessage()
- func (desc *TableDescriptor) RemoveColumnFromFamily(colID ColumnID)
- func (desc *TableDescriptor) RenameColumnNormalized(colID ColumnID, newColName string)
- func (desc *TableDescriptor) Renamed() bool
- func (m *TableDescriptor) Reset()
- func (desc *TableDescriptor) SetID(id ID)
- func (desc *TableDescriptor) SetName(name string)
- func (desc *TableDescriptor) SetUpVersion() error
- func (m *TableDescriptor) Size() (n int)
- func (m *TableDescriptor) String() string
- func (desc *TableDescriptor) TypeName() string
- func (m *TableDescriptor) Unmarshal(data []byte) error
- func (desc *TableDescriptor) Validate(txn *client.Txn) error
- func (desc *TableDescriptor) ValidateTable() error
- func (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor
- type TableDescriptor_CheckConstraint
- func (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)
- func (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_CheckConstraint) ProtoMessage()
- func (m *TableDescriptor_CheckConstraint) Reset()
- func (m *TableDescriptor_CheckConstraint) Size() (n int)
- func (m *TableDescriptor_CheckConstraint) String() string
- func (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error
- type TableDescriptor_RenameInfo
- func (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)
- func (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_RenameInfo) ProtoMessage()
- func (m *TableDescriptor_RenameInfo) Reset()
- func (m *TableDescriptor_RenameInfo) Size() (n int)
- func (m *TableDescriptor_RenameInfo) String() string
- func (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error
- type TableDescriptor_SchemaChangeLease
- func (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)
- func (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_SchemaChangeLease) ProtoMessage()
- func (m *TableDescriptor_SchemaChangeLease) Reset()
- func (m *TableDescriptor_SchemaChangeLease) Size() (n int)
- func (m *TableDescriptor_SchemaChangeLease) String() string
- func (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error
- type TableDescriptor_State
- type UserPrivilegeString
- type UserPrivileges
- func (*UserPrivileges) Descriptor() ([]byte, []int)
- func (m *UserPrivileges) Marshal() (data []byte, err error)
- func (m *UserPrivileges) MarshalTo(data []byte) (int, error)
- func (*UserPrivileges) ProtoMessage()
- func (m *UserPrivileges) Reset()
- func (m *UserPrivileges) Size() (n int)
- func (m *UserPrivileges) String() string
- func (m *UserPrivileges) Unmarshal(data []byte) error
Constants ¶
const ( // NamespaceTableSchema is checked in TestSystemTables. NamespaceTableSchema = ` CREATE TABLE system.namespace ( parentID INT, name STRING, id INT, PRIMARY KEY (parentID, name) );` // DescriptorTableSchema is checked in TestSystemTables. DescriptorTableSchema = ` CREATE TABLE system.descriptor ( id INT PRIMARY KEY, descriptor BYTES );` // UsersTableSchema is checked in TestSystemTables. UsersTableSchema = ` CREATE TABLE system.users ( username STRING PRIMARY KEY, hashedPassword BYTES );` // ZonesTableSchema is checked in TestSystemTables. // Zone settings per DB/Table. ZonesTableSchema = ` CREATE TABLE system.zones ( id INT PRIMARY KEY, config BYTES );` )
sql CREATE commands and full schema for each system table. These strings are *not* used at runtime, but are checked by the `TestSystemTableLiterals` test that compares the table generated by evaluating the `CREATE TABLE` statement to the descriptor literal that is actually used at runtime.
const ( // LeaseTableSchema is checked in TestSystemTables. LeaseTableSchema = `` /* 161-byte string literal not displayed */ // EventLogTableSchema describes the schema of the event log table. EventLogTableSchema = `` /* 300-byte string literal not displayed */ // RangeEventTableSchema defines the schema of the event log table. It is // currently envisioned as a wide table; many different event types can be // recorded to the table. RangeEventTableSchema = `` /* 314-byte string literal not displayed */ // UITableSchema is checked in TestSystemTables. // blobs based on unique keys. UITableSchema = ` CREATE TABLE system.ui ( key STRING PRIMARY KEY, value BYTES, lastUpdated TIMESTAMP NOT NULL );` )
These system tables are not part of the system config.
const FamilyHeuristicTargetBytes = 256
FamilyHeuristicTargetBytes is the target total byte size of columns that the current heuristic will assign to a family.
const (
// PrimaryKeyIndexName is the name of the index for the primary key.
PrimaryKeyIndexName = "primary"
)
Variables ¶
var ( ErrInvalidLengthBackup = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBackup = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthPrivilege = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPrivilege = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthStructured = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowStructured = fmt.Errorf("proto: integer overflow") )
var ( // SystemDB is the descriptor for the system database. SystemDB = DatabaseDescriptor{ Name: "system", ID: keys.SystemDatabaseID, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[keys.SystemDatabaseID]), } // NamespaceTable is the descriptor for the namespace table. NamespaceTable = TableDescriptor{ Name: "namespace", ID: keys.NamespaceTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "parentID", ID: 1, Type: colTypeInt}, {Name: "name", ID: 2, Type: colTypeString}, {Name: "id", ID: 3, Type: colTypeInt, Nullable: true}, }, NextColumnID: 4, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"parentID", "name"}, ColumnIDs: []ColumnID{1, 2}}, {Name: "fam_3_id", ID: 3, ColumnNames: []string{"id"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3}, }, NextFamilyID: 4, PrimaryIndex: IndexDescriptor{ Name: "primary", ID: 1, Unique: true, ColumnNames: []string{"parentID", "name"}, ColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC}, ColumnIDs: []ColumnID{1, 2}, }, NextIndexID: 2, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[2]), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // DescriptorTable is the descriptor for the descriptor table. DescriptorTable = TableDescriptor{ Name: "descriptor", ID: keys.DescriptorTableID, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[3]), ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "id", ID: 1, Type: colTypeInt}, {Name: "descriptor", ID: 2, Type: colTypeBytes, Nullable: true}, }, NextColumnID: 3, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"id"}, ColumnIDs: singleID1}, {Name: "fam_2_descriptor", ID: 2, ColumnNames: []string{"descriptor"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, }, PrimaryIndex: pk("id"), NextFamilyID: 3, NextIndexID: 2, FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // UsersTable is the descriptor for the users table. UsersTable = TableDescriptor{ Name: "users", ID: keys.UsersTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "username", ID: 1, Type: colTypeString}, {Name: "hashedPassword", ID: 2, Type: colTypeBytes, Nullable: true}, }, NextColumnID: 3, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"username"}, ColumnIDs: singleID1}, {Name: "fam_2_hashedPassword", ID: 2, ColumnNames: []string{"hashedPassword"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, }, PrimaryIndex: pk("username"), NextFamilyID: 3, NextIndexID: 2, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[4]), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // ZonesTable is the descriptor for the zones table. ZonesTable = TableDescriptor{ Name: "zones", ID: keys.ZonesTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "id", ID: 1, Type: colTypeInt}, {Name: "config", ID: 2, Type: colTypeBytes, Nullable: true}, }, NextColumnID: 3, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"id"}, ColumnIDs: singleID1}, {Name: "fam_2_config", ID: 2, ColumnNames: []string{"config"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, }, PrimaryIndex: pk("id"), NextFamilyID: 3, NextIndexID: 2, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemConfigAllowedPrivileges[5]), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // SystemConfigAllowedPrivileges describes the privileges allowed for each // system config object. No user may have more than those privileges, and // the root user must have exactly those privileges. CREATE|DROP|ALL // should always be denied. SystemConfigAllowedPrivileges = map[ID]privilege.List{ keys.SystemDatabaseID: privilege.ReadData, keys.NamespaceTableID: privilege.ReadData, keys.DescriptorTableID: privilege.ReadData, keys.UsersTableID: privilege.ReadWriteData, keys.ZonesTableID: privilege.ReadWriteData, } )
These system config TableDescriptor literals should match the descriptor that would be produced by evaluating one of the above `CREATE TABLE` statements. See the `TestSystemTableLiterals` which checks that they do indeed match, and has suggestions on writing and maintaining them.
var ( // LeaseTable is the descriptor for the leases table. LeaseTable = TableDescriptor{ Name: "lease", ID: keys.LeaseTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "descID", ID: 1, Type: colTypeInt}, {Name: "version", ID: 2, Type: colTypeInt}, {Name: "nodeID", ID: 3, Type: colTypeInt}, {Name: "expiration", ID: 4, Type: colTypeTimestamp}, }, NextColumnID: 5, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"descID", "version", "nodeID", "expiration"}, ColumnIDs: []ColumnID{1, 2, 3, 4}}, }, PrimaryIndex: IndexDescriptor{ Name: "primary", ID: 1, Unique: true, ColumnNames: []string{"descID", "version", "expiration", "nodeID"}, ColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC, IndexDescriptor_ASC, IndexDescriptor_ASC}, ColumnIDs: []ColumnID{1, 2, 4, 3}, }, NextFamilyID: 1, NextIndexID: 2, Privileges: NewDefaultPrivilegeDescriptor(), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // EventLogTable is the descriptor for the event log table. EventLogTable = TableDescriptor{ Name: "eventlog", ID: keys.EventLogTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "timestamp", ID: 1, Type: colTypeTimestamp}, {Name: "eventType", ID: 2, Type: colTypeString}, {Name: "targetID", ID: 3, Type: colTypeInt}, {Name: "reportingID", ID: 4, Type: colTypeInt}, {Name: "info", ID: 5, Type: colTypeString, Nullable: true}, {Name: "uniqueID", ID: 6, Type: colTypeBytes, DefaultExpr: &experimentalUniqueBytesString}, }, NextColumnID: 7, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"timestamp", "uniqueID"}, ColumnIDs: []ColumnID{1, 6}}, {Name: "fam_2_eventType", ID: 2, ColumnNames: []string{"eventType"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, {Name: "fam_3_targetID", ID: 3, ColumnNames: []string{"targetID"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3}, {Name: "fam_4_reportingID", ID: 4, ColumnNames: []string{"reportingID"}, ColumnIDs: []ColumnID{4}, DefaultColumnID: 4}, {Name: "fam_5_info", ID: 5, ColumnNames: []string{"info"}, ColumnIDs: []ColumnID{5}, DefaultColumnID: 5}, }, PrimaryIndex: IndexDescriptor{ Name: "primary", ID: 1, Unique: true, ColumnNames: []string{"timestamp", "uniqueID"}, ColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC}, ColumnIDs: []ColumnID{1, 6}, }, NextFamilyID: 6, NextIndexID: 2, Privileges: NewDefaultPrivilegeDescriptor(), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // RangeEventTable is the descriptor for the range log table. RangeEventTable = TableDescriptor{ Name: "rangelog", ID: keys.RangeEventTableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "timestamp", ID: 1, Type: colTypeTimestamp}, {Name: "rangeID", ID: 2, Type: colTypeInt}, {Name: "storeID", ID: 3, Type: colTypeInt}, {Name: "eventType", ID: 4, Type: colTypeString}, {Name: "otherRangeID", ID: 5, Type: colTypeInt, Nullable: true}, {Name: "info", ID: 6, Type: colTypeString, Nullable: true}, {Name: "uniqueID", ID: 7, Type: colTypeInt, DefaultExpr: &uniqueRowIDString}, }, NextColumnID: 8, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"timestamp", "uniqueID"}, ColumnIDs: []ColumnID{1, 7}}, {Name: "fam_2_rangeID", ID: 2, ColumnNames: []string{"rangeID"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, {Name: "fam_3_storeID", ID: 3, ColumnNames: []string{"storeID"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3}, {Name: "fam_4_eventType", ID: 4, ColumnNames: []string{"eventType"}, ColumnIDs: []ColumnID{4}, DefaultColumnID: 4}, {Name: "fam_5_otherRangeID", ID: 5, ColumnNames: []string{"otherRangeID"}, ColumnIDs: []ColumnID{5}, DefaultColumnID: 5}, {Name: "fam_6_info", ID: 6, ColumnNames: []string{"info"}, ColumnIDs: []ColumnID{6}, DefaultColumnID: 6}, }, PrimaryIndex: IndexDescriptor{ Name: "primary", ID: 1, Unique: true, ColumnNames: []string{"timestamp", "uniqueID"}, ColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC, IndexDescriptor_ASC}, ColumnIDs: []ColumnID{1, 7}, }, NextFamilyID: 7, NextIndexID: 2, Privileges: NewDefaultPrivilegeDescriptor(), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } // UITable is the descriptor for the ui table. UITable = TableDescriptor{ Name: "ui", ID: keys.UITableID, ParentID: 1, Version: 1, Columns: []ColumnDescriptor{ {Name: "key", ID: 1, Type: colTypeString}, {Name: "value", ID: 2, Type: colTypeBytes, Nullable: true}, {Name: "lastUpdated", ID: 3, Type: ColumnType{Kind: ColumnType_TIMESTAMP}}, }, NextColumnID: 4, Families: []ColumnFamilyDescriptor{ {Name: "primary", ID: 0, ColumnNames: []string{"key"}, ColumnIDs: singleID1}, {Name: "fam_2_value", ID: 2, ColumnNames: []string{"value"}, ColumnIDs: []ColumnID{2}, DefaultColumnID: 2}, {Name: "fam_3_lastUpdated", ID: 3, ColumnNames: []string{"lastUpdated"}, ColumnIDs: []ColumnID{3}, DefaultColumnID: 3}, }, NextFamilyID: 4, PrimaryIndex: pk("key"), NextIndexID: 2, Privileges: NewDefaultPrivilegeDescriptor(), FormatVersion: InterleavedFormatVersion, NextMutationID: 1, } )
These system TableDescriptor literals should match the descriptor that would be produced by evaluating one of the above `CREATE TABLE` statements for system tables that are not system config tables. See the `TestSystemTableLiterals` which checks that they do indeed match, and has suggestions on writing and maintaining them.
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",
}
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,
}
var ConstraintValidity_name = map[int32]string{
0: "Validated",
1: "Unvalidated",
}
var ConstraintValidity_value = map[string]int32{
"Validated": 0,
"Unvalidated": 1,
}
var DatumEncoding_name = map[int32]string{
0: "ASCENDING_KEY",
1: "DESCENDING_KEY",
2: "VALUE",
}
var DatumEncoding_value = map[string]int32{
"ASCENDING_KEY": 0,
"DESCENDING_KEY": 1,
"VALUE": 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,
}
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,
}
var ErrDescriptorNotFound = errors.New("descriptor not found")
ErrDescriptorNotFound is returned by GetTableDescFromID to signal that a descriptor could not be found with the given id.
var ErrMissingColumns = errors.New("table must contain at least 1 column")
ErrMissingColumns indicates a table with no columns.
var ErrMissingPrimaryKey = errors.New("table must contain a primary key")
ErrMissingPrimaryKey indicates a table with no primary key.
var IndexDescriptor_Direction_name = map[int32]string{
0: "ASC",
1: "DESC",
}
var IndexDescriptor_Direction_value = map[string]int32{
"ASC": 0,
"DESC": 1,
}
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,
}
Functions ¶
func CheckColumnType ¶
func CheckColumnType(col ColumnDescriptor, val parser.Datum, pmap *parser.PlaceholderInfo) error
CheckColumnType 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.
func CheckValueWidth ¶
func CheckValueWidth(col ColumnDescriptor, val parser.Datum) error
CheckValueWidth checks that the width (for strings, byte arrays, and bit string) and scale (for decimals) of the value fits the specified column type. Used by INSERT and UPDATE.
func ColumnsSelectors ¶
func ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs
ColumnsSelectors generates Select expressions for cols.
func DecodeIndexKey ¶
func DecodeIndexKey( a *DatumAlloc, desc *TableDescriptor, indexID IndexID, valTypes, vals []parser.Datum, colDirs []encoding.Direction, key []byte, ) ([]byte, bool, error)
DecodeIndexKey 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. If the given descriptor does not match the key, false is returned with no error.
func DecodeKeyVals ¶
func DecodeKeyVals(a *DatumAlloc, valTypes, vals []parser.Datum, directions []encoding.Direction, key []byte) ([]byte, error)
DecodeKeyVals 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) >= 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.
func DecodeTableIDIndexID ¶
DecodeTableIDIndexID decodes a table id followed by an index id.
func DecodeTableKey ¶
func DecodeTableKey( a *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction, ) (parser.Datum, []byte, error)
DecodeTableKey decodes a table key/value.
func DecodeTableValue ¶
DecodeTableValue decodes a value encoded by EncodeTableValue.
func EncodeColumns ¶
func EncodeColumns( columnIDs []ColumnID, directions directions, colMap map[ColumnID]int, values []parser.Datum, keyPrefix []byte, ) (key []byte, containsNull bool, err error)
EncodeColumns is a version of EncodeIndexKey that takes ColumnIDs and directions explicitly.
func EncodeDTuple ¶
EncodeDTuple encodes a DTuple (order-preserving).
func EncodeDatum ¶
EncodeDatum encodes a datum (order-preserving encoding, suitable for keys).
func EncodeIndexKey ¶
func EncodeIndexKey( tableDesc *TableDescriptor, index *IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, keyPrefix []byte, ) (key []byte, containsNull bool, err error)
EncodeIndexKey creates a key by concatenating keyPrefix with the encodings of the columns in the index.
If a table or index is interleaved, `encoding.encodedNullDesc` is used in place of the family id (a varint) to signal the next component of the key. An example of one level of interleaving (a parent): /<parent_table_id>/<parent_index_id>/<field_1>/<field_2>/NullDesc/<table_id>/<index_id>/<field_3>/<family>
Returns the key and whether any of the encoded values were NULLs.
Note that ImplicitColumnIDs are not encoded, so the result isn't always a full index key.
func EncodeSecondaryIndexes ¶
func EncodeSecondaryIndexes( tableDesc *TableDescriptor, indexes []IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, secondaryIndexEntries []IndexEntry, ) error
EncodeSecondaryIndexes encodes key/values for the secondary indexes. colMap maps ColumnIDs to indices in `values`. secondaryIndexEntries is the return value (passed as a parameter so the caller can reuse between rows) and is expected to be the same length as indexes.
func EncodeTableKey ¶
EncodeTableKey encodes `val` into `b` and returns the new buffer.
func EncodeTableValue ¶
EncodeTableValue encodes `val` into `appendTo` using DatumEncoding_VALUE and returns the new buffer.
func ExtractIndexKey ¶
func ExtractIndexKey( a *DatumAlloc, tableDesc *TableDescriptor, entry client.KeyValue, ) (roachpb.Key, error)
ExtractIndexKey constructs the index (primary) key for a row from any index key/value entry, including secondary indexes.
Don't use this function in the scan "hot path".
func IsIntegrityConstraintError ¶
IsIntegrityConstraintError returns true if the error is some kind of SQL constraint violation.
func IsSystemConfigID ¶
IsSystemConfigID returns true if this ID is for a system config object.
func MakeAllDescsMetadataKey ¶
MakeAllDescsMetadataKey returns the key for all descriptors.
func MakeColumnDefDescs ¶
func MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)
MakeColumnDefDescs creates the column descriptor for a column, as well as the index descriptor if the column is a primary key or unique.
func MakeDescMetadataKey ¶
MakeDescMetadataKey returns the key for the descriptor.
func MakeIndexKeyPrefix ¶
func MakeIndexKeyPrefix(desc *TableDescriptor, indexID IndexID) []byte
MakeIndexKeyPrefix returns the key prefix used for the index's data.
func MakeKeyFromEncDatums ¶
func MakeKeyFromEncDatums( values EncDatumRow, directions []IndexDescriptor_Direction, keyPrefix []byte, alloc *DatumAlloc, ) (key roachpb.Key, err error)
MakeKeyFromEncDatums creates a key by concatenating keyPrefix with the encodings of the given EncDatum values.
func MakeKeyVals ¶
func MakeKeyVals( desc *TableDescriptor, columnIDs []ColumnID, ) ([]parser.Datum, error)
MakeKeyVals returns a slice of Datums with the correct types for the given columns.
func MakeNameMetadataKey ¶
MakeNameMetadataKey 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.
func MakeZoneKey ¶
MakeZoneKey returns the key for 'id's entry in the system.zones table.
func MarshalColumnValue ¶
MarshalColumnValue 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.
func NewDatabaseAlreadyExistsError ¶
NewDatabaseAlreadyExistsError creates a new ErrDatabaseAlreadyExists.
func NewNonNullViolationError ¶
NewNonNullViolationError creates a new ErrNonNullViolation.
func NewRelationAlreadyExistsError ¶
NewRelationAlreadyExistsError creates a new ErrRelationAlreadyExists.
func NewTransactionAbortedError ¶
NewTransactionAbortedError creates a new ErrTransactionAborted.
func NewTransactionCommittedError ¶
func NewTransactionCommittedError() error
NewTransactionCommittedError creates a new ErrTransactionCommitted.
func NewUndefinedDatabaseError ¶
NewUndefinedDatabaseError creates a new ErrUndefinedDatabase.
func NewUndefinedTableError ¶
NewUndefinedTableError creates a new ErrUndefinedTable.
func NewUndefinedViewError ¶
NewUndefinedViewError creates a new ErrUndefinedTable, which is also used for views (sharing the same postgres error code).
func NewUniquenessConstraintViolationError ¶
func NewUniquenessConstraintViolationError( index *IndexDescriptor, vals []parser.Datum, ) error
NewUniquenessConstraintViolationError creates a new ErrUniquenessConstrainViolation.
func NewWrongObjectTypeError ¶
NewWrongObjectTypeError creates a new ErrWrongObjectType.
func NormalizeName ¶
NormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).
func NormalizeTableName ¶
NormalizeTableName normalizes the TableName using NormalizeName().
func PrettySpan ¶
PrettySpan returns a human-readable representation of a span.
func PrettySpans ¶
PrettySpans returns a human-readable description of the spans.
func RandDatum ¶
RandDatum generates a random Datum of the given type. If null is true, the datum can be DNull.
func RandEncDatumSlices ¶
RandEncDatumSlices generates EncDatum slices, each slice with values of the same random type.
func ReNormalizeName ¶
ReNormalizeName performs the same work as NormalizeName but when the string originates from the database. We define a different function so as to be able to track usage of this function (cf. #8200).
func SanitizeVarFreeExpr ¶
SanitizeVarFreeExpr verifies a default expression is valid, has the correct type and contains no variable expressions.
func SetKVBatchSize ¶
func SetKVBatchSize(val int64) func()
SetKVBatchSize changes the kvFetcher batch size, and returns a function that restores it.
func UnmarshalColumnValue ¶
func UnmarshalColumnValue( a *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value, ) (parser.Datum, error)
UnmarshalColumnValue 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.
Types ¶
type BackupDescriptor ¶
type BackupDescriptor struct { EndTime cockroach_util_hlc.Timestamp `protobuf:"bytes,1,opt,name=end_time,json=endTime" json:"end_time"` Ranges []BackupRangeDescriptor `protobuf:"bytes,2,rep,name=ranges" json:"ranges"` SQL []Descriptor `protobuf:"bytes,3,rep,name=sql" json:"sql"` // TODO(dan): Consider also including total file size and per-range data and // file size. DataSize int64 `protobuf:"varint,4,opt,name=data_size,json=dataSize,proto3" json:"data_size,omitempty"` }
BackupDescriptor represents a consistent snapshot of ranges.
Each range snapshot includes a path to data that is a diff of the data in that key range between a start and end timestamp. The end timestamp of all ranges in a backup is the same, but the start may vary (to allow individual tables to be backed up on different schedules).
func (*BackupDescriptor) Descriptor ¶
func (*BackupDescriptor) Descriptor() ([]byte, []int)
func (*BackupDescriptor) Marshal ¶
func (m *BackupDescriptor) Marshal() (data []byte, err error)
func (*BackupDescriptor) ProtoMessage ¶
func (*BackupDescriptor) ProtoMessage()
func (*BackupDescriptor) Reset ¶
func (m *BackupDescriptor) Reset()
func (*BackupDescriptor) Size ¶
func (m *BackupDescriptor) Size() (n int)
func (*BackupDescriptor) String ¶
func (m *BackupDescriptor) String() string
func (*BackupDescriptor) Unmarshal ¶
func (m *BackupDescriptor) Unmarshal(data []byte) error
type BackupRangeDescriptor ¶
type BackupRangeDescriptor struct { // An empty path means the range is empty. Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` StartKey github_com_cockroachdb_cockroach_roachpb.Key `` /* 139-byte string literal not displayed */ EndKey github_com_cockroachdb_cockroach_roachpb.Key `` /* 133-byte string literal not displayed */ StartTime cockroach_util_hlc.Timestamp `protobuf:"bytes,4,opt,name=start_time,json=startTime" json:"start_time"` CRC uint32 `protobuf:"varint,5,opt,name=crc,proto3" json:"crc,omitempty"` }
BackupRangeDescriptor represents a file that contains the diff for a key range between two timestamps.
func (*BackupRangeDescriptor) Descriptor ¶
func (*BackupRangeDescriptor) Descriptor() ([]byte, []int)
func (*BackupRangeDescriptor) Marshal ¶
func (m *BackupRangeDescriptor) Marshal() (data []byte, err error)
func (*BackupRangeDescriptor) MarshalTo ¶
func (m *BackupRangeDescriptor) MarshalTo(data []byte) (int, error)
func (*BackupRangeDescriptor) ProtoMessage ¶
func (*BackupRangeDescriptor) ProtoMessage()
func (*BackupRangeDescriptor) Reset ¶
func (m *BackupRangeDescriptor) Reset()
func (*BackupRangeDescriptor) Size ¶
func (m *BackupRangeDescriptor) Size() (n int)
func (*BackupRangeDescriptor) String ¶
func (m *BackupRangeDescriptor) String() string
func (*BackupRangeDescriptor) Unmarshal ¶
func (m *BackupRangeDescriptor) Unmarshal(data []byte) error
type ColumnDescriptor ¶
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 (*ColumnDescriptor) Descriptor ¶
func (*ColumnDescriptor) Descriptor() ([]byte, []int)
func (*ColumnDescriptor) Marshal ¶
func (m *ColumnDescriptor) Marshal() (data []byte, err error)
func (*ColumnDescriptor) ProtoMessage ¶
func (*ColumnDescriptor) ProtoMessage()
func (*ColumnDescriptor) Reset ¶
func (m *ColumnDescriptor) Reset()
func (*ColumnDescriptor) Size ¶
func (m *ColumnDescriptor) Size() (n int)
func (*ColumnDescriptor) String ¶
func (m *ColumnDescriptor) String() string
func (*ColumnDescriptor) Unmarshal ¶
func (m *ColumnDescriptor) Unmarshal(data []byte) error
type ColumnFamilyDescriptor ¶
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"` }
ColumnFamilyDescriptor is set of columns stored together in one kv entry.
func (*ColumnFamilyDescriptor) Descriptor ¶
func (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int)
func (*ColumnFamilyDescriptor) Marshal ¶
func (m *ColumnFamilyDescriptor) Marshal() (data []byte, err error)
func (*ColumnFamilyDescriptor) MarshalTo ¶
func (m *ColumnFamilyDescriptor) MarshalTo(data []byte) (int, error)
func (*ColumnFamilyDescriptor) ProtoMessage ¶
func (*ColumnFamilyDescriptor) ProtoMessage()
func (*ColumnFamilyDescriptor) Reset ¶
func (m *ColumnFamilyDescriptor) Reset()
func (*ColumnFamilyDescriptor) Size ¶
func (m *ColumnFamilyDescriptor) Size() (n int)
func (*ColumnFamilyDescriptor) String ¶
func (m *ColumnFamilyDescriptor) String() string
func (*ColumnFamilyDescriptor) Unmarshal ¶
func (m *ColumnFamilyDescriptor) Unmarshal(data []byte) error
type ColumnOrderInfo ¶
ColumnOrderInfo describes a column (as an index) and a desired order direction.
type ColumnOrdering ¶
type ColumnOrdering []ColumnOrderInfo
ColumnOrdering is used to describe a desired column ordering. For example,
[]ColumnOrderInfo{ {3, true}, {1, false} }
represents an ordering first by column 3 (descending), then by column 1 (ascending).
type ColumnType ¶
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"` }
func (*ColumnType) Descriptor ¶
func (*ColumnType) Descriptor() ([]byte, []int)
func (*ColumnType) Marshal ¶
func (m *ColumnType) Marshal() (data []byte, err error)
func (*ColumnType) MaxCharacterLength ¶
func (c *ColumnType) MaxCharacterLength() (int32, bool)
MaxCharacterLength returns the declared maximum length of characters if the ColumnType is a character or bit string data type. Returns false if the data type is not a character or bit string, or if the string's length is not bounded.
func (*ColumnType) MaxOctetLength ¶
func (c *ColumnType) MaxOctetLength() (int32, bool)
MaxOctetLength returns the maximum the maximum possible length in octets of a datum if the ColumnType is a character string. Returns false if the data type is not a character string, or if the string's length is not bounded.
func (*ColumnType) NumericPrecision ¶
func (c *ColumnType) NumericPrecision() (int32, bool)
NumericPrecision returns the declared or implicit precision of numeric data types. Returns false if the data type is not numeric, or if the precision of the numeric type is not bounded.
func (*ColumnType) NumericScale ¶
func (c *ColumnType) NumericScale() (int32, bool)
NumericScale returns the declared or implicit precision of exact numeric data types. Returns false if the data type is not an exact numeric, or if the scale of the exact numeric type is not bounded.
func (*ColumnType) ProtoMessage ¶
func (*ColumnType) ProtoMessage()
func (*ColumnType) Reset ¶
func (m *ColumnType) Reset()
func (*ColumnType) SQLString ¶
func (c *ColumnType) SQLString() string
SQLString returns the SQL string corresponding to the type.
func (*ColumnType) Size ¶
func (m *ColumnType) Size() (n int)
func (*ColumnType) String ¶
func (m *ColumnType) String() string
func (*ColumnType) ToDatumType ¶
func (c *ColumnType) ToDatumType() parser.Datum
ToDatumType converts the ColumnType to the correct type Datum, or nil if there is no correspondence.
func (*ColumnType) Unmarshal ¶
func (m *ColumnType) Unmarshal(data []byte) error
type ColumnType_Kind ¶
type ColumnType_Kind int32
These mirror the types supported by the sql/parser. See sql/parser/types.go.
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 )
func RandColumnType ¶
func RandColumnType(rng *rand.Rand) ColumnType_Kind
RandColumnType returns a random ColumnType_Kind value.
func (ColumnType_Kind) Enum ¶
func (x ColumnType_Kind) Enum() *ColumnType_Kind
func (ColumnType_Kind) EnumDescriptor ¶
func (ColumnType_Kind) EnumDescriptor() ([]byte, []int)
func (ColumnType_Kind) String ¶
func (x ColumnType_Kind) String() string
func (ColumnType_Kind) ToDatumType ¶
func (k ColumnType_Kind) ToDatumType() parser.Datum
ToDatumType converts the ColumnType_Kind to the correct type Datum, or nil if there is no correspondence.
func (*ColumnType_Kind) UnmarshalJSON ¶
func (x *ColumnType_Kind) UnmarshalJSON(data []byte) error
type ConstraintDetail ¶
type ConstraintDetail struct { Kind ConstraintType Columns []string Details string Unvalidated bool }
ConstraintDetail describes a constraint.
type ConstraintType ¶
type ConstraintType string
ConstraintType is used to itentify the type of a constraint.
const ( // ConstraintTypePK identifies a PRIMARY KEY constraint. ConstraintTypePK ConstraintType = "PRIMARY KEY" // ConstraintTypeFK identifies a FOREIGN KEY constraint. ConstraintTypeFK ConstraintType = "FOREIGN KEY" // ConstraintTypeUnique identifies a FOREIGN constraint. ConstraintTypeUnique ConstraintType = "UNIQUE" // ConstraintTypeCheck identifies a CHECK constraint. ConstraintTypeCheck ConstraintType = "CHECK" )
type ConstraintValidity ¶
type ConstraintValidity int32
const ( ConstraintValidity_Validated ConstraintValidity = 0 ConstraintValidity_Unvalidated ConstraintValidity = 1 )
func (ConstraintValidity) Enum ¶
func (x ConstraintValidity) Enum() *ConstraintValidity
func (ConstraintValidity) EnumDescriptor ¶
func (ConstraintValidity) EnumDescriptor() ([]byte, []int)
func (ConstraintValidity) String ¶
func (x ConstraintValidity) String() string
func (*ConstraintValidity) UnmarshalJSON ¶
func (x *ConstraintValidity) UnmarshalJSON(data []byte) error
type DatabaseDescriptor ¶
type DatabaseDescriptor struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID ID `protobuf:"varint,2,opt,name=id,casttype=ID" json:"id"` Privileges *PrivilegeDescriptor `protobuf:"bytes,3,opt,name=privileges" json:"privileges,omitempty"` }
DatabaseDescriptor 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.
func (*DatabaseDescriptor) Descriptor ¶
func (*DatabaseDescriptor) Descriptor() ([]byte, []int)
func (*DatabaseDescriptor) GetID ¶
func (m *DatabaseDescriptor) GetID() ID
func (*DatabaseDescriptor) GetName ¶
func (m *DatabaseDescriptor) GetName() string
func (*DatabaseDescriptor) GetPrivileges ¶
func (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor
func (*DatabaseDescriptor) Marshal ¶
func (m *DatabaseDescriptor) Marshal() (data []byte, err error)
func (*DatabaseDescriptor) MarshalTo ¶
func (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)
func (*DatabaseDescriptor) ProtoMessage ¶
func (*DatabaseDescriptor) ProtoMessage()
func (*DatabaseDescriptor) Reset ¶
func (m *DatabaseDescriptor) Reset()
func (*DatabaseDescriptor) SetID ¶
func (desc *DatabaseDescriptor) SetID(id ID)
SetID implements the DescriptorProto interface.
func (*DatabaseDescriptor) SetName ¶
func (desc *DatabaseDescriptor) SetName(name string)
SetName implements the DescriptorProto interface.
func (*DatabaseDescriptor) Size ¶
func (m *DatabaseDescriptor) Size() (n int)
func (*DatabaseDescriptor) String ¶
func (m *DatabaseDescriptor) String() string
func (*DatabaseDescriptor) TypeName ¶
func (desc *DatabaseDescriptor) TypeName() string
TypeName returns the plain type of this descriptor.
func (*DatabaseDescriptor) Unmarshal ¶
func (m *DatabaseDescriptor) Unmarshal(data []byte) error
func (*DatabaseDescriptor) Validate ¶
func (desc *DatabaseDescriptor) Validate() error
Validate 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.
type DatumAlloc ¶
type DatumAlloc struct {
// contains filtered or unexported fields
}
DatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations.
func (*DatumAlloc) NewDBytes ¶
func (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes
NewDBytes allocates a DBytes.
func (*DatumAlloc) NewDDate ¶
func (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate
NewDDate allocates a DDate.
func (*DatumAlloc) NewDDecimal ¶
func (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal
NewDDecimal allocates a DDecimal.
func (*DatumAlloc) NewDFloat ¶
func (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat
NewDFloat allocates a DFloat.
func (*DatumAlloc) NewDInt ¶
func (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt
NewDInt allocates a DInt.
func (*DatumAlloc) NewDInterval ¶
func (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval
NewDInterval allocates a DInterval.
func (*DatumAlloc) NewDString ¶
func (a *DatumAlloc) NewDString(v parser.DString) *parser.DString
NewDString allocates a DString.
func (*DatumAlloc) NewDTimestamp ¶
func (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp
NewDTimestamp allocates a DTimestamp.
func (*DatumAlloc) NewDTimestampTZ ¶
func (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ
NewDTimestampTZ allocates a DTimestampTZ.
type DatumEncoding ¶
type DatumEncoding int32
DatumEncoding identifies the encoding used for an EncDatum.
const ( // Indicates that the datum is encoded using the order-preserving encoding // used for keys (ascending order). DatumEncoding_ASCENDING_KEY DatumEncoding = 0 // Indicates that the datum is encoded using the order-preserving encoding // used for keys (descending order). DatumEncoding_DESCENDING_KEY DatumEncoding = 1 // Indicates that the datum is encoded using the encoding used for values. DatumEncoding_VALUE DatumEncoding = 2 )
func RandDatumEncoding ¶
func RandDatumEncoding(rng *rand.Rand) DatumEncoding
RandDatumEncoding returns a random DatumEncoding value.
func (DatumEncoding) Enum ¶
func (x DatumEncoding) Enum() *DatumEncoding
func (DatumEncoding) EnumDescriptor ¶
func (DatumEncoding) EnumDescriptor() ([]byte, []int)
func (DatumEncoding) String ¶
func (x DatumEncoding) String() string
func (*DatumEncoding) UnmarshalJSON ¶
func (x *DatumEncoding) UnmarshalJSON(data []byte) error
type Descriptor ¶
type Descriptor struct { // Types that are valid to be assigned to Union: // *Descriptor_Table // *Descriptor_Database Union isDescriptor_Union `protobuf_oneof:"union"` }
Descriptor is a union type holding either a table or database descriptor.
func WrapDescriptor ¶
func WrapDescriptor(descriptor DescriptorProto) *Descriptor
WrapDescriptor fills in a Descriptor.
func (*Descriptor) Descriptor ¶
func (*Descriptor) Descriptor() ([]byte, []int)
func (*Descriptor) GetDatabase ¶
func (m *Descriptor) GetDatabase() *DatabaseDescriptor
func (*Descriptor) GetID ¶
func (desc *Descriptor) GetID() ID
GetID returns the ID of the descriptor.
func (*Descriptor) GetName ¶
func (desc *Descriptor) GetName() string
GetName returns the Name of the descriptor.
func (*Descriptor) GetTable ¶
func (m *Descriptor) GetTable() *TableDescriptor
func (*Descriptor) GetUnion ¶
func (m *Descriptor) GetUnion() isDescriptor_Union
func (*Descriptor) Marshal ¶
func (m *Descriptor) Marshal() (data []byte, err error)
func (*Descriptor) ProtoMessage ¶
func (*Descriptor) ProtoMessage()
func (*Descriptor) Reset ¶
func (m *Descriptor) Reset()
func (*Descriptor) Size ¶
func (m *Descriptor) Size() (n int)
func (*Descriptor) String ¶
func (m *Descriptor) String() string
func (*Descriptor) Unmarshal ¶
func (m *Descriptor) Unmarshal(data []byte) error
func (*Descriptor) XXX_OneofFuncs ¶
func (*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{})
XXX_OneofFuncs is for the internal use of the proto package.
type DescriptorKey ¶
DescriptorKey is the interface implemented by both databaseKey and tableKey. It is used to easily get the descriptor key and plain name.
type DescriptorMutation ¶
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 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.
func (*DescriptorMutation) Descriptor ¶
func (*DescriptorMutation) Descriptor() ([]byte, []int)
func (*DescriptorMutation) GetColumn ¶
func (m *DescriptorMutation) GetColumn() *ColumnDescriptor
func (*DescriptorMutation) GetDescriptor_ ¶
func (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_
func (*DescriptorMutation) GetIndex ¶
func (m *DescriptorMutation) GetIndex() *IndexDescriptor
func (*DescriptorMutation) Marshal ¶
func (m *DescriptorMutation) Marshal() (data []byte, err error)
func (*DescriptorMutation) MarshalTo ¶
func (m *DescriptorMutation) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation) ProtoMessage ¶
func (*DescriptorMutation) ProtoMessage()
func (*DescriptorMutation) Reset ¶
func (m *DescriptorMutation) Reset()
func (*DescriptorMutation) Size ¶
func (m *DescriptorMutation) Size() (n int)
func (*DescriptorMutation) String ¶
func (m *DescriptorMutation) String() string
func (*DescriptorMutation) Unmarshal ¶
func (m *DescriptorMutation) Unmarshal(data []byte) error
func (*DescriptorMutation) XXX_OneofFuncs ¶
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{})
XXX_OneofFuncs is for the internal use of the proto package.
type DescriptorMutation_Column ¶
type DescriptorMutation_Column struct {
Column *ColumnDescriptor `protobuf:"bytes,1,opt,name=column,oneof"`
}
func (*DescriptorMutation_Column) MarshalTo ¶
func (m *DescriptorMutation_Column) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation_Column) Size ¶
func (m *DescriptorMutation_Column) Size() (n int)
type DescriptorMutation_Direction ¶
type DescriptorMutation_Direction int32
Direction of mutation.
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 )
func (DescriptorMutation_Direction) Enum ¶
func (x DescriptorMutation_Direction) Enum() *DescriptorMutation_Direction
func (DescriptorMutation_Direction) EnumDescriptor ¶
func (DescriptorMutation_Direction) EnumDescriptor() ([]byte, []int)
func (DescriptorMutation_Direction) String ¶
func (x DescriptorMutation_Direction) String() string
func (*DescriptorMutation_Direction) UnmarshalJSON ¶
func (x *DescriptorMutation_Direction) UnmarshalJSON(data []byte) error
type DescriptorMutation_Index ¶
type DescriptorMutation_Index struct {
Index *IndexDescriptor `protobuf:"bytes,2,opt,name=index,oneof"`
}
func (*DescriptorMutation_Index) MarshalTo ¶
func (m *DescriptorMutation_Index) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation_Index) Size ¶
func (m *DescriptorMutation_Index) Size() (n int)
type DescriptorMutation_State ¶
type DescriptorMutation_State int32
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.
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 )
func (DescriptorMutation_State) Enum ¶
func (x DescriptorMutation_State) Enum() *DescriptorMutation_State
func (DescriptorMutation_State) EnumDescriptor ¶
func (DescriptorMutation_State) EnumDescriptor() ([]byte, []int)
func (DescriptorMutation_State) String ¶
func (x DescriptorMutation_State) String() string
func (*DescriptorMutation_State) UnmarshalJSON ¶
func (x *DescriptorMutation_State) UnmarshalJSON(data []byte) error
type DescriptorProto ¶
type DescriptorProto interface { proto.Message GetPrivileges() *PrivilegeDescriptor GetID() ID SetID(ID) TypeName() string GetName() string SetName(string) }
DescriptorProto is the interface implemented by both DatabaseDescriptor and TableDescriptor. TODO(marc): this is getting rather large.
type DescriptorStatus ¶
type DescriptorStatus int
DescriptorStatus is the status for a descriptor.
const ( // DescriptorAbsent for a descriptor that doesn't exist. DescriptorAbsent DescriptorStatus // DescriptorIncomplete for a descriptor that is a part of a // schema change, and is still being processed. DescriptorIncomplete // DescriptorActive for a descriptor that is completely active // for read/write and delete operations. DescriptorActive )
type DescriptorVersion ¶
type DescriptorVersion uint32
DescriptorVersion is a custom type for TableDescriptor Versions.
type Descriptor_Database ¶
type Descriptor_Database struct {
Database *DatabaseDescriptor `protobuf:"bytes,2,opt,name=database,oneof"`
}
func (*Descriptor_Database) MarshalTo ¶
func (m *Descriptor_Database) MarshalTo(data []byte) (int, error)
func (*Descriptor_Database) Size ¶
func (m *Descriptor_Database) Size() (n int)
type Descriptor_Table ¶
type Descriptor_Table struct {
Table *TableDescriptor `protobuf:"bytes,1,opt,name=table,oneof"`
}
func (*Descriptor_Table) Size ¶
func (m *Descriptor_Table) Size() (n int)
type EncDatum ¶
type EncDatum struct { Type ColumnType_Kind // Decoded datum. Datum parser.Datum // contains filtered or unexported fields }
EncDatum 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).
func RandEncDatum ¶
RandEncDatum generates a random EncDatum (of a random type).
func RandEncDatumSlice ¶
RandEncDatumSlice generates a slice of random EncDatum values of the same random type.
func (*EncDatum) Compare ¶
func (ed *EncDatum) Compare(a *DatumAlloc, rhs *EncDatum) (int, error)
Compare returns:
-1 if the receiver is less than rhs, 0 if the receiver is equal to rhs, +1 if the receiver is greater than rhs.
func (*EncDatum) Decode ¶
func (ed *EncDatum) Decode(a *DatumAlloc) error
Decode ensures that Datum is set (decoding if necessary).
func (*EncDatum) Encode ¶
func (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)
Encode appends the encoded datum to the given slice using the requested encoding.
func (*EncDatum) Encoding ¶
func (ed *EncDatum) Encoding() (DatumEncoding, bool)
Encoding returns the encoding that is already available (the latter indicated by the bool return value).
func (*EncDatum) SetDatum ¶
func (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)
SetDatum initializes the EncDatum with the given Datum.
func (*EncDatum) SetEncoded ¶
func (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)
SetEncoded 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.
func (*EncDatum) SetFromBuffer ¶
func (ed *EncDatum) SetFromBuffer( typ ColumnType_Kind, enc DatumEncoding, buf []byte, ) (remaining []byte, err error)
SetFromBuffer initializes the EncDatum with an encoding that is possibly followed by other data. Similar to SetEncoded, except that this function figures out where the encoding stops and returns a slice for the rest of the buffer.
type EncDatumRow ¶
type EncDatumRow []EncDatum
EncDatumRow is a row of EncDatums.
func (EncDatumRow) Compare ¶
func (r EncDatumRow) Compare(a *DatumAlloc, ordering ColumnOrdering, rhs EncDatumRow) (int, error)
Compare returns the relative ordering of two EncDatumRows according to a ColumnOrdering:
-1 if the receiver comes before the rhs in the ordering, +1 if the receiver comes after the rhs in the ordering, 0 if the relative order does not matter (i.e. the two rows have the same values for the columns in the ordering).
Note that a return value of 0 does not (in general) imply that the rows are equal; for example, rows [1 1 5] and [1 1 6] when compared against ordering {{0, asc}, {1, asc}} (i.e. ordered by first column and then by second column).
func (EncDatumRow) String ¶
func (r EncDatumRow) String() string
type EncDatumRowAlloc ¶
type EncDatumRowAlloc struct {
// contains filtered or unexported fields
}
EncDatumRowAlloc is a helper that speeds up allocation of EncDatumRows (preferably of the same length).
func (*EncDatumRowAlloc) AllocRow ¶
func (a *EncDatumRowAlloc) AllocRow(cols int) EncDatumRow
AllocRow allocates an EncDatumRow with the given number of columns.
func (*EncDatumRowAlloc) CopyRow ¶
func (a *EncDatumRowAlloc) CopyRow(row EncDatumRow) EncDatumRow
CopyRow allocates an EncDatumRow and copies the given row to it.
type EncDatumRows ¶
type EncDatumRows []EncDatumRow
EncDatumRows is a slice of EncDatumRows.
func (EncDatumRows) String ¶
func (r EncDatumRows) String() string
type ErrDatabaseAlreadyExists ¶
type ErrDatabaseAlreadyExists struct {
// contains filtered or unexported fields
}
ErrDatabaseAlreadyExists represents a missing database error.
func (*ErrDatabaseAlreadyExists) Code ¶
func (*ErrDatabaseAlreadyExists) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrDatabaseAlreadyExists) Error ¶
func (e *ErrDatabaseAlreadyExists) Error() string
func (*ErrDatabaseAlreadyExists) SrcContext ¶
func (e *ErrDatabaseAlreadyExists) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrNonNullViolation ¶
type ErrNonNullViolation struct {
// contains filtered or unexported fields
}
ErrNonNullViolation represents a violation of a non-NULL constraint.
func (*ErrNonNullViolation) Code ¶
func (*ErrNonNullViolation) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrNonNullViolation) Error ¶
func (e *ErrNonNullViolation) Error() string
func (*ErrNonNullViolation) SrcContext ¶
func (e *ErrNonNullViolation) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrRelationAlreadyExists ¶
type ErrRelationAlreadyExists struct {
// contains filtered or unexported fields
}
ErrRelationAlreadyExists represents a missing database error.
func (*ErrRelationAlreadyExists) Code ¶
func (*ErrRelationAlreadyExists) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrRelationAlreadyExists) Error ¶
func (e *ErrRelationAlreadyExists) Error() string
func (*ErrRelationAlreadyExists) SrcContext ¶
func (e *ErrRelationAlreadyExists) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrRetry ¶
type ErrRetry struct {
// contains filtered or unexported fields
}
ErrRetry means that the transaction can be retried. It signals to the user that the SQL txn entered the RESTART_WAIT state after a serialization error, and that a ROLLBACK TO SAVEPOINT COCKROACH_RESTART statement should be issued.
func (*ErrRetry) SrcContext ¶
SrcContext implements the ErrorWithPGCode interface.
type ErrSyntax ¶
type ErrSyntax struct {
// contains filtered or unexported fields
}
ErrSyntax represents a syntax error.
func (*ErrSyntax) SrcContext ¶
SrcContext implements the ErrorWithPGCode interface.
type ErrTransactionAborted ¶
type ErrTransactionAborted struct { CustomMsg string // contains filtered or unexported fields }
ErrTransactionAborted represents an error for trying to run a command in the context of transaction that's already aborted.
func (*ErrTransactionAborted) Code ¶
func (*ErrTransactionAborted) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrTransactionAborted) Error ¶
func (e *ErrTransactionAborted) Error() string
func (*ErrTransactionAborted) SrcContext ¶
func (e *ErrTransactionAborted) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrTransactionCommitted ¶
type ErrTransactionCommitted struct {
// contains filtered or unexported fields
}
ErrTransactionCommitted signals that the SQL txn is in the COMMIT_WAIT state and that only a COMMIT statement will be accepted.
func (*ErrTransactionCommitted) Code ¶
func (*ErrTransactionCommitted) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrTransactionCommitted) Error ¶
func (*ErrTransactionCommitted) Error() string
func (*ErrTransactionCommitted) SrcContext ¶
func (e *ErrTransactionCommitted) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUndefinedDatabase ¶
type ErrUndefinedDatabase struct {
// contains filtered or unexported fields
}
ErrUndefinedDatabase represents a missing database error.
func (*ErrUndefinedDatabase) Code ¶
func (*ErrUndefinedDatabase) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUndefinedDatabase) Error ¶
func (e *ErrUndefinedDatabase) Error() string
func (*ErrUndefinedDatabase) SrcContext ¶
func (e *ErrUndefinedDatabase) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUndefinedTable ¶
type ErrUndefinedTable struct {
// contains filtered or unexported fields
}
ErrUndefinedTable represents a missing database table.
func (*ErrUndefinedTable) Code ¶
func (*ErrUndefinedTable) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUndefinedTable) Error ¶
func (e *ErrUndefinedTable) Error() string
func (*ErrUndefinedTable) SrcContext ¶
func (e *ErrUndefinedTable) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUniquenessConstraintViolation ¶
type ErrUniquenessConstraintViolation struct {
// contains filtered or unexported fields
}
ErrUniquenessConstraintViolation represents a violation of a UNIQUE constraint.
func (*ErrUniquenessConstraintViolation) Code ¶
func (*ErrUniquenessConstraintViolation) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUniquenessConstraintViolation) Error ¶
func (e *ErrUniquenessConstraintViolation) Error() string
func (*ErrUniquenessConstraintViolation) SrcContext ¶
func (e *ErrUniquenessConstraintViolation) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrWrongObjectType ¶
type ErrWrongObjectType struct {
// contains filtered or unexported fields
}
ErrWrongObjectType represents a wrong object type error.
func (*ErrWrongObjectType) Code ¶
func (*ErrWrongObjectType) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrWrongObjectType) Error ¶
func (e *ErrWrongObjectType) Error() string
func (*ErrWrongObjectType) SrcContext ¶
func (e *ErrWrongObjectType) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrorWithPGCode ¶
ErrorWithPGCode represents errors that carries an error code to the user. pgwire recognizes this interfaces and extracts the code.
type ForeignKeyReference ¶
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"` }
func (*ForeignKeyReference) Descriptor ¶
func (*ForeignKeyReference) Descriptor() ([]byte, []int)
func (ForeignKeyReference) IsSet ¶
func (f ForeignKeyReference) IsSet() bool
IsSet returns whether or not the foreign key actually references a table.
func (*ForeignKeyReference) Marshal ¶
func (m *ForeignKeyReference) Marshal() (data []byte, err error)
func (*ForeignKeyReference) MarshalTo ¶
func (m *ForeignKeyReference) MarshalTo(data []byte) (int, error)
func (*ForeignKeyReference) ProtoMessage ¶
func (*ForeignKeyReference) ProtoMessage()
func (*ForeignKeyReference) Reset ¶
func (m *ForeignKeyReference) Reset()
func (*ForeignKeyReference) Size ¶
func (m *ForeignKeyReference) Size() (n int)
func (*ForeignKeyReference) String ¶
func (m *ForeignKeyReference) String() string
func (*ForeignKeyReference) Unmarshal ¶
func (m *ForeignKeyReference) Unmarshal(data []byte) error
type FormatVersion ¶
type FormatVersion uint32
FormatVersion is a custom type for TableDescriptor versions of the sql to key:value mapping.
const ( // BaseFormatVersion corresponds to the encoding described in // https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/. BaseFormatVersion FormatVersion // FamilyFormatVersion corresponds to the encoding described in // https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_column_families.md FamilyFormatVersion // InterleavedFormatVersion corresponds to the encoding described in // https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_interleaved_tables.md InterleavedFormatVersion )
func (FormatVersion) String ¶
func (i FormatVersion) String() string
type IndexDescriptor ¶
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. 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,4,rep,name=column_names,json=columnNames" json:"column_names,omitempty"` // Parallel with column_names - the sort direction of each column. ColumnDirections []IndexDescriptor_Direction `` /* 156-byte string literal not displayed */ // An ordered list of column names which the index stores in // addition to the columns which are explicitly part of the index. 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. ColumnIDs []ColumnID `protobuf:"varint,6,rep,name=column_ids,json=columnIds,casttype=ColumnID" json:"column_ids,omitempty"` // An ordered list of implicit column ids associated with the index. For // non-unique indexes, these columns will be appended to the key. For unique // indexes these columns will be stored in the value. The extra column IDs is // computed as PrimaryIndex.column_ids - column_ids. For the primary index // the list will be empty. // The distinction about whether the columns are written in the key or the value // comes because we want to always do writes using a single operation - this // way for unique indexes we can do a conditional put on the key. ImplicitColumnIDs []ColumnID `` /* 126-byte string literal not displayed */ 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 (*IndexDescriptor) ContainsColumnID ¶
func (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool
ContainsColumnID returns true if the index descriptor contains the specified column ID either in its explicit column IDs or the implicit "extra" column IDs.
func (*IndexDescriptor) Descriptor ¶
func (*IndexDescriptor) Descriptor() ([]byte, []int)
func (*IndexDescriptor) FillColumns ¶
func (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error
FillColumns sets the column names and directions in desc.
func (*IndexDescriptor) FullColumnIDs ¶
func (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)
FullColumnIDs 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.
func (*IndexDescriptor) Marshal ¶
func (m *IndexDescriptor) Marshal() (data []byte, err error)
func (*IndexDescriptor) ProtoMessage ¶
func (*IndexDescriptor) ProtoMessage()
func (*IndexDescriptor) Reset ¶
func (m *IndexDescriptor) Reset()
func (*IndexDescriptor) Size ¶
func (m *IndexDescriptor) Size() (n int)
func (*IndexDescriptor) String ¶
func (m *IndexDescriptor) String() string
func (*IndexDescriptor) Unmarshal ¶
func (m *IndexDescriptor) Unmarshal(data []byte) error
type IndexDescriptor_Direction ¶
type IndexDescriptor_Direction int32
The direction of a column in the index.
const ( IndexDescriptor_ASC IndexDescriptor_Direction = 0 IndexDescriptor_DESC IndexDescriptor_Direction = 1 )
func (IndexDescriptor_Direction) Enum ¶
func (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction
func (IndexDescriptor_Direction) EnumDescriptor ¶
func (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)
func (IndexDescriptor_Direction) String ¶
func (x IndexDescriptor_Direction) String() string
func (IndexDescriptor_Direction) ToEncodingDirection ¶
func (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)
ToEncodingDirection converts a direction from the proto to an encoding.Direction.
func (*IndexDescriptor_Direction) UnmarshalJSON ¶
func (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error
type IndexEntry ¶
IndexEntry represents an encoded key/value for an index entry.
func EncodeSecondaryIndex ¶
func EncodeSecondaryIndex( tableDesc *TableDescriptor, secondaryIndex *IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, ) (IndexEntry, error)
EncodeSecondaryIndex encodes key/values for a secondary index. colMap maps ColumnIDs to indices in `values`.
type IndexID ¶
type IndexID uint32
IndexID is a custom type for IndexDescriptor IDs.
func DecodeIndexKeyPrefix ¶
func DecodeIndexKeyPrefix(a *DatumAlloc, desc *TableDescriptor, key []byte) ( indexID IndexID, remaining []byte, err error, )
DecodeIndexKeyPrefix decodes the prefix of an index key and returns the index id and a slice for the rest of the key.
Don't use this function in the scan "hot path".
type InterleaveDescriptor ¶
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"` }
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.
func (*InterleaveDescriptor) Descriptor ¶
func (*InterleaveDescriptor) Descriptor() ([]byte, []int)
func (*InterleaveDescriptor) Marshal ¶
func (m *InterleaveDescriptor) Marshal() (data []byte, err error)
func (*InterleaveDescriptor) MarshalTo ¶
func (m *InterleaveDescriptor) MarshalTo(data []byte) (int, error)
func (*InterleaveDescriptor) ProtoMessage ¶
func (*InterleaveDescriptor) ProtoMessage()
func (*InterleaveDescriptor) Reset ¶
func (m *InterleaveDescriptor) Reset()
func (*InterleaveDescriptor) Size ¶
func (m *InterleaveDescriptor) Size() (n int)
func (*InterleaveDescriptor) String ¶
func (m *InterleaveDescriptor) String() string
func (*InterleaveDescriptor) Unmarshal ¶
func (m *InterleaveDescriptor) Unmarshal(data []byte) error
type InterleaveDescriptor_Ancestor ¶
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"` // 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 (*InterleaveDescriptor_Ancestor) Descriptor ¶
func (*InterleaveDescriptor_Ancestor) Descriptor() ([]byte, []int)
func (*InterleaveDescriptor_Ancestor) Marshal ¶
func (m *InterleaveDescriptor_Ancestor) Marshal() (data []byte, err error)
func (*InterleaveDescriptor_Ancestor) MarshalTo ¶
func (m *InterleaveDescriptor_Ancestor) MarshalTo(data []byte) (int, error)
func (*InterleaveDescriptor_Ancestor) ProtoMessage ¶
func (*InterleaveDescriptor_Ancestor) ProtoMessage()
func (*InterleaveDescriptor_Ancestor) Reset ¶
func (m *InterleaveDescriptor_Ancestor) Reset()
func (*InterleaveDescriptor_Ancestor) Size ¶
func (m *InterleaveDescriptor_Ancestor) Size() (n int)
func (*InterleaveDescriptor_Ancestor) String ¶
func (m *InterleaveDescriptor_Ancestor) String() string
func (*InterleaveDescriptor_Ancestor) Unmarshal ¶
func (m *InterleaveDescriptor_Ancestor) Unmarshal(data []byte) error
type MetadataSchema ¶
type MetadataSchema struct {
// contains filtered or unexported fields
}
MetadataSchema 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.
func MakeMetadataSchema ¶
func MakeMetadataSchema() MetadataSchema
MakeMetadataSchema constructs a new MetadataSchema value which constructs the "system" database.
func (*MetadataSchema) AddConfigDescriptor ¶
func (ms *MetadataSchema) AddConfigDescriptor(parentID ID, desc DescriptorProto)
AddConfigDescriptor adds a new descriptor to the system schema. Used only for SystemConfig tables and databases.
func (*MetadataSchema) AddDescriptor ¶
func (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)
AddDescriptor adds a new non-config descriptor to the system schema.
func (MetadataSchema) GetInitialValues ¶
func (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue
GetInitialValues 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.
func (MetadataSchema) SystemConfigDescriptorCount ¶
func (ms MetadataSchema) SystemConfigDescriptorCount() int
SystemConfigDescriptorCount returns the number of config descriptors that will be created by this schema. This value is needed to automate certain tests.
func (MetadataSchema) SystemDescriptorCount ¶
func (ms MetadataSchema) SystemDescriptorCount() int
SystemDescriptorCount returns the number of descriptors that will be created by this schema. This value is needed to automate certain tests.
type MutationID ¶
type MutationID uint32
MutationID is custom type for TableDescriptor mutations.
const InvalidMutationID MutationID = 0
InvalidMutationID is the uninitialised mutation id.
type PrivilegeDescriptor ¶
type PrivilegeDescriptor struct {
Users []UserPrivileges `protobuf:"bytes,1,rep,name=users" json:"users"`
}
PrivilegeDescriptor describes a list of users and attached privileges. The list should be sorted by user for fast access.
func NewDefaultPrivilegeDescriptor ¶
func NewDefaultPrivilegeDescriptor() *PrivilegeDescriptor
NewDefaultPrivilegeDescriptor returns a privilege descriptor with ALL privileges for the root user.
func NewPrivilegeDescriptor ¶
func NewPrivilegeDescriptor(user string, priv privilege.List) *PrivilegeDescriptor
NewPrivilegeDescriptor returns a privilege descriptor for the given user with the specified list of privileges.
func (PrivilegeDescriptor) AnyPrivilege ¶
func (p PrivilegeDescriptor) AnyPrivilege(user string) bool
AnyPrivilege returns true if 'user' has any privilege on this descriptor.
func (PrivilegeDescriptor) CheckPrivilege ¶
func (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool
CheckPrivilege returns true if 'user' has 'privilege' on this descriptor.
func (*PrivilegeDescriptor) Descriptor ¶
func (*PrivilegeDescriptor) Descriptor() ([]byte, []int)
func (*PrivilegeDescriptor) Grant ¶
func (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)
Grant 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?
func (*PrivilegeDescriptor) Marshal ¶
func (m *PrivilegeDescriptor) Marshal() (data []byte, err error)
func (*PrivilegeDescriptor) MarshalTo ¶
func (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)
func (*PrivilegeDescriptor) ProtoMessage ¶
func (*PrivilegeDescriptor) ProtoMessage()
func (*PrivilegeDescriptor) Reset ¶
func (m *PrivilegeDescriptor) Reset()
func (*PrivilegeDescriptor) Revoke ¶
func (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)
Revoke removes privileges from this descriptor for a given list of users.
func (PrivilegeDescriptor) Show ¶
func (p PrivilegeDescriptor) Show() []UserPrivilegeString
Show returns the list of {username, privileges} sorted by username. 'privileges' is a string of comma-separated sorted privilege names.
func (*PrivilegeDescriptor) Size ¶
func (m *PrivilegeDescriptor) Size() (n int)
func (*PrivilegeDescriptor) String ¶
func (m *PrivilegeDescriptor) String() string
func (*PrivilegeDescriptor) Unmarshal ¶
func (m *PrivilegeDescriptor) Unmarshal(data []byte) error
func (PrivilegeDescriptor) Validate ¶
func (p PrivilegeDescriptor) Validate(id ID) error
Validate 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.
type RowFetcher ¶
type RowFetcher struct {
// contains filtered or unexported fields
}
RowFetcher handles fetching kvs and forming table rows. Usage:
var rf RowFetcher err := rf.Init(..) // Handle err err := rf.StartScan(..) // Handle err for { row, err := rf.NextRow() // Handle err if row == nil { // Done break } // Process row }
func (*RowFetcher) Init ¶
func (rf *RowFetcher) Init( desc *TableDescriptor, colIdxMap map[ColumnID]int, index *IndexDescriptor, reverse, isSecondaryIndex bool, cols []ColumnDescriptor, valNeededForCol []bool, ) error
Init 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.
func (*RowFetcher) Key ¶
func (rf *RowFetcher) Key() roachpb.Key
Key returns the next key (the key that follows the last returned row).
func (*RowFetcher) NextKey ¶
func (rf *RowFetcher) NextKey() (rowDone bool, err error)
NextKey retrieves the next key/value and sets kv/kvEnd. Returns whether a row has been completed. TODO(andrei): change to return error
func (*RowFetcher) NextKeyDebug ¶
func (rf *RowFetcher) NextKeyDebug() ( prettyKey string, prettyValue string, row parser.DTuple, err error, )
NextKeyDebug 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 "".
func (*RowFetcher) NextRow ¶
func (rf *RowFetcher) NextRow() (parser.DTuple, error)
NextRow 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.
The DTuple should not be modified and is only valid until the next call. When there are no more rows, the DTuple is nil.
func (*RowFetcher) ProcessKV ¶
func (rf *RowFetcher) ProcessKV(kv client.KeyValue, debugStrings bool) ( prettyKey string, prettyValue string, err error, )
ProcessKV 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).
func (*RowFetcher) ReadIndexKey ¶
ReadIndexKey decodes an index key for the fetcher's table.
type SrcCtx ¶
SrcCtx contains contextual information about the source of an error.
func MakeSrcCtx ¶
MakeSrcCtx creates a SrcCtx value with contextual information about the caller at the requested depth.
type TableDescriptor ¶
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. // // 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"` }
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.
func GetTableDescFromID ¶
func GetTableDescFromID(txn *client.Txn, id ID) (*TableDescriptor, error)
GetTableDescFromID retrieves the table descriptor for the table ID passed in using an existing txn. Teturns an error if the descriptor doesn't exist or if it exists and is not a table.
func GetTableDescriptor ¶
func GetTableDescriptor(kvDB *client.DB, database string, table string) *TableDescriptor
GetTableDescriptor retrieves a table descriptor directly from the KV layer.
func (*TableDescriptor) AddColumn ¶
func (desc *TableDescriptor) AddColumn(col ColumnDescriptor)
AddColumn adds a column to the table.
func (*TableDescriptor) AddColumnMutation ¶
func (desc *TableDescriptor) AddColumnMutation(c ColumnDescriptor, direction DescriptorMutation_Direction)
AddColumnMutation adds a column mutation to desc.Mutations.
func (*TableDescriptor) AddColumnToFamilyMaybeCreate ¶
func (desc *TableDescriptor) AddColumnToFamilyMaybeCreate( col string, family string, create bool, ifNotExists bool, ) error
AddColumnToFamilyMaybeCreate adds the specified column to the specified family. If it doesn't exist and create is true, creates it. If it does exist adds it unless "strict" create (`true` for create but `false` for ifNotExists) is specified.
AllocateIDs must be called before the TableDesciptor will be valid.
func (*TableDescriptor) AddFamily ¶
func (desc *TableDescriptor) AddFamily(fam ColumnFamilyDescriptor)
AddFamily adds a family to the table.
func (*TableDescriptor) AddIndex ¶
func (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error
AddIndex adds an index to the table.
func (*TableDescriptor) AddIndexMutation ¶
func (desc *TableDescriptor) AddIndexMutation(idx IndexDescriptor, direction DescriptorMutation_Direction)
AddIndexMutation adds an index mutation to desc.Mutations.
func (*TableDescriptor) Adding ¶
func (desc *TableDescriptor) Adding() bool
Adding returns true if the table is being added.
func (*TableDescriptor) AllNonDropIndexes ¶
func (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor
AllNonDropIndexes returns all the indexes, including those being added in the mutations.
func (*TableDescriptor) AllocateIDs ¶
func (desc *TableDescriptor) AllocateIDs() error
AllocateIDs allocates column, family, and index ids for any column, family, or index which has an ID of 0.
func (TableDescriptor) CheckUniqueConstraints ¶
func (desc TableDescriptor) CheckUniqueConstraints() error
CheckUniqueConstraints returns a non-nil error if a descriptor contains two constraints with the same name.
func (*TableDescriptor) Deleted ¶
func (desc *TableDescriptor) Deleted() bool
Deleted returns true if the table is being deleted.
func (*TableDescriptor) Descriptor ¶
func (*TableDescriptor) Descriptor() ([]byte, []int)
func (*TableDescriptor) FinalizeMutation ¶
func (desc *TableDescriptor) FinalizeMutation() (MutationID, error)
FinalizeMutation 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.
func (*TableDescriptor) FindActiveColumnByID ¶
func (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)
FindActiveColumnByID finds the active column with specified ID.
func (*TableDescriptor) FindActiveColumnByName ¶
func (desc *TableDescriptor) FindActiveColumnByName(name parser.Name) (ColumnDescriptor, error)
FindActiveColumnByName calls FindActiveColumnByNormalizedName on a normalized argument.
func (*TableDescriptor) FindActiveColumnByNormalizedName ¶
func (desc *TableDescriptor) FindActiveColumnByNormalizedName(normName string) (ColumnDescriptor, error)
FindActiveColumnByNormalizedName finds an active column with the specified normalized name.
func (*TableDescriptor) FindActiveColumnsByNames ¶
func (desc *TableDescriptor) FindActiveColumnsByNames(names parser.NameList) ([]ColumnDescriptor, error)
FindActiveColumnsByNames finds all requested columns (in the requested order) or returns an error.
func (*TableDescriptor) FindColumnByID ¶
func (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)
FindColumnByID finds the column with specified ID.
func (*TableDescriptor) FindColumnByName ¶
func (desc *TableDescriptor) FindColumnByName(name parser.Name) (DescriptorStatus, int, error)
FindColumnByName calls FindColumnByNormalizedName with a normalized argument.
func (*TableDescriptor) FindColumnByNormalizedName ¶
func (desc *TableDescriptor) FindColumnByNormalizedName(normName string) (DescriptorStatus, int, error)
FindColumnByNormalizedName 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).
func (*TableDescriptor) FindFamilyByID ¶
func (desc *TableDescriptor) FindFamilyByID(id FamilyID) (*ColumnFamilyDescriptor, error)
FindFamilyByID finds the family with specified ID.
func (*TableDescriptor) FindIndexByID ¶
func (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)
FindIndexByID finds an index (active or inactive) with the specified ID. Must return a pointer to the IndexDescriptor in the TableDescriptor, so that callers can use returned values to modify the TableDesc.
func (*TableDescriptor) FindIndexByName ¶
func (desc *TableDescriptor) FindIndexByName(name parser.Name) (DescriptorStatus, int, error)
FindIndexByName calls FindIndexByNormalizedName on a normalized argument.
func (*TableDescriptor) FindIndexByNormalizedName ¶
func (desc *TableDescriptor) FindIndexByNormalizedName(normName string) (DescriptorStatus, int, error)
FindIndexByNormalizedName 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).
func (*TableDescriptor) GetChecks ¶
func (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint
func (*TableDescriptor) GetColumns ¶
func (m *TableDescriptor) GetColumns() []ColumnDescriptor
func (TableDescriptor) GetConstraintInfo ¶
func (desc TableDescriptor) GetConstraintInfo(txn *client.Txn) (map[string]ConstraintDetail, error)
GetConstraintInfo returns a summary of all constraints on the table.
func (*TableDescriptor) GetFamilies ¶
func (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor
func (*TableDescriptor) GetFormatVersion ¶
func (m *TableDescriptor) GetFormatVersion() FormatVersion
func (*TableDescriptor) GetID ¶
func (m *TableDescriptor) GetID() ID
func (*TableDescriptor) GetIndexes ¶
func (m *TableDescriptor) GetIndexes() []IndexDescriptor
func (*TableDescriptor) GetLease ¶
func (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease
func (*TableDescriptor) GetModificationTime ¶
func (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp
func (*TableDescriptor) GetMutations ¶
func (m *TableDescriptor) GetMutations() []DescriptorMutation
func (*TableDescriptor) GetName ¶
func (m *TableDescriptor) GetName() string
func (*TableDescriptor) GetNextColumnID ¶
func (m *TableDescriptor) GetNextColumnID() ColumnID
func (*TableDescriptor) GetNextFamilyID ¶
func (m *TableDescriptor) GetNextFamilyID() FamilyID
func (*TableDescriptor) GetNextIndexID ¶
func (m *TableDescriptor) GetNextIndexID() IndexID
func (*TableDescriptor) GetNextMutationID ¶
func (m *TableDescriptor) GetNextMutationID() MutationID
func (*TableDescriptor) GetParentID ¶
func (m *TableDescriptor) GetParentID() ID
func (*TableDescriptor) GetPrimaryIndex ¶
func (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor
func (*TableDescriptor) GetPrivileges ¶
func (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor
func (*TableDescriptor) GetRenames ¶
func (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo
func (*TableDescriptor) GetState ¶
func (m *TableDescriptor) GetState() TableDescriptor_State
func (*TableDescriptor) GetUpVersion ¶
func (m *TableDescriptor) GetUpVersion() bool
func (*TableDescriptor) GetVersion ¶
func (m *TableDescriptor) GetVersion() DescriptorVersion
func (*TableDescriptor) GetViewQuery ¶
func (m *TableDescriptor) GetViewQuery() string
func (*TableDescriptor) IsEmpty ¶
func (desc *TableDescriptor) IsEmpty() bool
IsEmpty checks if the descriptor is uninitialized.
func (*TableDescriptor) IsInterleaved ¶
func (desc *TableDescriptor) IsInterleaved() bool
IsInterleaved returns true if any part of this this table is interleaved with another table's data.
func (*TableDescriptor) IsPhysicalTable ¶
func (desc *TableDescriptor) IsPhysicalTable() bool
IsPhysicalTable returns true if the TableDescriptor actually describes a physical Table that needs to be stored in the kv layer, as opposed to a different resource like a view or a virtual table. Physical tables have primary keys, column families, and indexes (unlike virtual tables).
func (*TableDescriptor) IsTable ¶
func (desc *TableDescriptor) IsTable() bool
IsTable returns true if the TableDescriptor actually describes a Table resource, as opposed to a different resource (like a View).
func (*TableDescriptor) IsView ¶
func (desc *TableDescriptor) IsView() bool
IsView returns true if the TableDescriptor actually describes a View resource rather than a Table.
func (*TableDescriptor) IsVirtualTable ¶
func (desc *TableDescriptor) IsVirtualTable() bool
IsVirtualTable returns true if the TableDescriptor describes a virtual Table (like the information_schema tables) and thus doesn't need to be physically stored.
func (*TableDescriptor) MakeMutationComplete ¶
func (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)
MakeMutationComplete updates the descriptor upon completion of a mutation.
func (*TableDescriptor) Marshal ¶
func (m *TableDescriptor) Marshal() (data []byte, err error)
func (*TableDescriptor) MaybeUpgradeFormatVersion ¶
func (desc *TableDescriptor) MaybeUpgradeFormatVersion() bool
MaybeUpgradeFormatVersion transforms the TableDescriptor to the latest FormatVersion (if it's not already there) and returns true if any changes were made.
func (*TableDescriptor) ProtoMessage ¶
func (*TableDescriptor) ProtoMessage()
func (*TableDescriptor) RemoveColumnFromFamily ¶
func (desc *TableDescriptor) RemoveColumnFromFamily(colID ColumnID)
RemoveColumnFromFamily removes a colID from the family it's assigned to.
func (*TableDescriptor) RenameColumnNormalized ¶
func (desc *TableDescriptor) RenameColumnNormalized(colID ColumnID, newColName string)
RenameColumnNormalized updates all references to a column name in indexes and families.
func (*TableDescriptor) Renamed ¶
func (desc *TableDescriptor) Renamed() bool
Renamed returns true if the table is being renamed.
func (*TableDescriptor) Reset ¶
func (m *TableDescriptor) Reset()
func (*TableDescriptor) SetID ¶
func (desc *TableDescriptor) SetID(id ID)
SetID implements the DescriptorProto interface.
func (*TableDescriptor) SetName ¶
func (desc *TableDescriptor) SetName(name string)
SetName implements the DescriptorProto interface.
func (*TableDescriptor) SetUpVersion ¶
func (desc *TableDescriptor) SetUpVersion() error
SetUpVersion sets the up_version marker on the table descriptor (see the proto
func (*TableDescriptor) Size ¶
func (m *TableDescriptor) Size() (n int)
func (*TableDescriptor) String ¶
func (m *TableDescriptor) String() string
func (*TableDescriptor) TypeName ¶
func (desc *TableDescriptor) TypeName() string
TypeName returns the plain type of this descriptor.
func (*TableDescriptor) Unmarshal ¶
func (m *TableDescriptor) Unmarshal(data []byte) error
func (*TableDescriptor) Validate ¶
func (desc *TableDescriptor) Validate(txn *client.Txn) error
Validate validates that the table descriptor is well formed. Checks include both single table and cross table invariants.
func (*TableDescriptor) ValidateTable ¶
func (desc *TableDescriptor) ValidateTable() error
ValidateTable 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. Use Validate to validate that cross-table references are correct.
func (*TableDescriptor) VisibleColumns ¶
func (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor
VisibleColumns returns all non hidden columns.
type TableDescriptor_CheckConstraint ¶
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 (*TableDescriptor_CheckConstraint) Descriptor ¶
func (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)
func (*TableDescriptor_CheckConstraint) Marshal ¶
func (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)
func (*TableDescriptor_CheckConstraint) MarshalTo ¶
func (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_CheckConstraint) ProtoMessage ¶
func (*TableDescriptor_CheckConstraint) ProtoMessage()
func (*TableDescriptor_CheckConstraint) Reset ¶
func (m *TableDescriptor_CheckConstraint) Reset()
func (*TableDescriptor_CheckConstraint) Size ¶
func (m *TableDescriptor_CheckConstraint) Size() (n int)
func (*TableDescriptor_CheckConstraint) String ¶
func (m *TableDescriptor_CheckConstraint) String() string
func (*TableDescriptor_CheckConstraint) Unmarshal ¶
func (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error
type TableDescriptor_RenameInfo ¶
type TableDescriptor_RenameInfo struct { // The database that the table belonged to before the rename (tables can be // renamed from one db to another). OldParentID ID `protobuf:"varint,1,opt,name=old_parent_id,json=oldParentId,casttype=ID" json:"old_parent_id"` OldName string `protobuf:"bytes,2,opt,name=old_name,json=oldName" json:"old_name"` }
func (*TableDescriptor_RenameInfo) Descriptor ¶
func (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)
func (*TableDescriptor_RenameInfo) Marshal ¶
func (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)
func (*TableDescriptor_RenameInfo) MarshalTo ¶
func (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_RenameInfo) ProtoMessage ¶
func (*TableDescriptor_RenameInfo) ProtoMessage()
func (*TableDescriptor_RenameInfo) Reset ¶
func (m *TableDescriptor_RenameInfo) Reset()
func (*TableDescriptor_RenameInfo) Size ¶
func (m *TableDescriptor_RenameInfo) Size() (n int)
func (*TableDescriptor_RenameInfo) String ¶
func (m *TableDescriptor_RenameInfo) String() string
func (*TableDescriptor_RenameInfo) Unmarshal ¶
func (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error
type TableDescriptor_SchemaChangeLease ¶
type TableDescriptor_SchemaChangeLease struct { NodeID 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"` // Nanoseconds since the Unix epoch. ExpirationTime int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time"` }
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.
func (*TableDescriptor_SchemaChangeLease) Descriptor ¶
func (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)
func (*TableDescriptor_SchemaChangeLease) Marshal ¶
func (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)
func (*TableDescriptor_SchemaChangeLease) MarshalTo ¶
func (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_SchemaChangeLease) ProtoMessage ¶
func (*TableDescriptor_SchemaChangeLease) ProtoMessage()
func (*TableDescriptor_SchemaChangeLease) Reset ¶
func (m *TableDescriptor_SchemaChangeLease) Reset()
func (*TableDescriptor_SchemaChangeLease) Size ¶
func (m *TableDescriptor_SchemaChangeLease) Size() (n int)
func (*TableDescriptor_SchemaChangeLease) String ¶
func (m *TableDescriptor_SchemaChangeLease) String() string
func (*TableDescriptor_SchemaChangeLease) Unmarshal ¶
func (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error
type TableDescriptor_State ¶
type TableDescriptor_State int32
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.
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 )
func (TableDescriptor_State) Enum ¶
func (x TableDescriptor_State) Enum() *TableDescriptor_State
func (TableDescriptor_State) EnumDescriptor ¶
func (TableDescriptor_State) EnumDescriptor() ([]byte, []int)
func (TableDescriptor_State) String ¶
func (x TableDescriptor_State) String() string
func (*TableDescriptor_State) UnmarshalJSON ¶
func (x *TableDescriptor_State) UnmarshalJSON(data []byte) error
type UserPrivilegeString ¶
UserPrivilegeString is a pair of strings describing the privileges for a given user.
func (UserPrivilegeString) PrivilegeString ¶
func (u UserPrivilegeString) PrivilegeString() string
PrivilegeString returns a string of comma-separted privilege names.
type UserPrivileges ¶
type UserPrivileges struct { User string `protobuf:"bytes,1,opt,name=user" json:"user"` // privileges is a bitfield of 1<<Privilege values. Privileges uint32 `protobuf:"varint,2,opt,name=privileges" json:"privileges"` }
UserPrivileges describes the list of privileges available for a given user.
func (*UserPrivileges) Descriptor ¶
func (*UserPrivileges) Descriptor() ([]byte, []int)
func (*UserPrivileges) Marshal ¶
func (m *UserPrivileges) Marshal() (data []byte, err error)
func (*UserPrivileges) ProtoMessage ¶
func (*UserPrivileges) ProtoMessage()
func (*UserPrivileges) Reset ¶
func (m *UserPrivileges) Reset()
func (*UserPrivileges) Size ¶
func (m *UserPrivileges) Size() (n int)
func (*UserPrivileges) String ¶
func (m *UserPrivileges) String() string
func (*UserPrivileges) Unmarshal ¶
func (m *UserPrivileges) Unmarshal(data []byte) error