Documentation ¶
Index ¶
- Constants
- Variables
- func ChooseVindexForType(typ querypb.Type) (string, error)
- func LoadFormal(filename string) (*vschemapb.SrvVSchema, error)
- func LoadFormalKeyspace(filename string) (*vschemapb.Keyspace, error)
- func Map(ctx context.Context, vindex Vindex, vcursor VCursor, ...) ([]key.Destination, error)
- func NewKeyRangeFromPrefix(begin []byte) key.Destination
- func Register(vindexType string, newVindexFunc NewVindexFunc)
- func ValidateKeyspace(input *vschemapb.Keyspace) error
- func Verify(ctx context.Context, vindex Vindex, vcursor VCursor, ...) ([]bool, error)
- type AutoIncrement
- type Binary
- func (cached *Binary) CachedSize(alloc bool) int64
- func (vind *Binary) Cost() int
- func (vind *Binary) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *Binary) IsUnique() bool
- func (vind *Binary) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *Binary) NeedsVCursor() bool
- func (*Binary) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error)
- func (vind *Binary) String() string
- func (vind *Binary) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type BinaryMD5
- func (cached *BinaryMD5) CachedSize(alloc bool) int64
- func (vind *BinaryMD5) Cost() int
- func (vind *BinaryMD5) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *BinaryMD5) IsUnique() bool
- func (vind *BinaryMD5) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *BinaryMD5) NeedsVCursor() bool
- func (vind *BinaryMD5) String() string
- func (vind *BinaryMD5) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type ByCost
- type CFC
- func (cached *CFC) CachedSize(alloc bool) int64
- func (vind *CFC) Cost() int
- func (vind *CFC) IsUnique() bool
- func (vind *CFC) Map(_ context.Context, _ VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *CFC) NeedsVCursor() bool
- func (vind *CFC) PrefixVindex() SingleColumn
- func (vind *CFC) String() string
- func (vind *CFC) Verify(_ context.Context, _ VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Column
- type ColumnVindex
- type ConsistentLookup
- func (lu *ConsistentLookup) AllowBatch() bool
- func (lu *ConsistentLookup) AutoCommitEnabled() bool
- func (cached *ConsistentLookup) CachedSize(alloc bool) int64
- func (lu *ConsistentLookup) Cost() int
- func (lu ConsistentLookup) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu ConsistentLookup) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu ConsistentLookup) GetCommitOrder() vtgatepb.CommitOrder
- func (lu *ConsistentLookup) IsUnique() bool
- func (lu *ConsistentLookup) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lu *ConsistentLookup) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lu ConsistentLookup) MarshalJSON() ([]byte, error)
- func (lu *ConsistentLookup) NeedsVCursor() bool
- func (lu *ConsistentLookup) Query() (selQuery string, arguments []string)
- func (lu ConsistentLookup) SetOwnerInfo(keyspace, table string, cols []sqlparser.IdentifierCI) error
- func (lu ConsistentLookup) String() string
- func (lu ConsistentLookup) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lu ConsistentLookup) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type ConsistentLookupUnique
- func (lu *ConsistentLookupUnique) AllowBatch() bool
- func (lu *ConsistentLookupUnique) AutoCommitEnabled() bool
- func (cached *ConsistentLookupUnique) CachedSize(alloc bool) int64
- func (lu *ConsistentLookupUnique) Cost() int
- func (lu ConsistentLookupUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu ConsistentLookupUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu ConsistentLookupUnique) GetCommitOrder() vtgatepb.CommitOrder
- func (lu *ConsistentLookupUnique) IsBackfilling() bool
- func (lu *ConsistentLookupUnique) IsUnique() bool
- func (lu *ConsistentLookupUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lu *ConsistentLookupUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lu ConsistentLookupUnique) MarshalJSON() ([]byte, error)
- func (lu *ConsistentLookupUnique) NeedsVCursor() bool
- func (lu *ConsistentLookupUnique) Query() (selQuery string, arguments []string)
- func (lu ConsistentLookupUnique) SetOwnerInfo(keyspace, table string, cols []sqlparser.IdentifierCI) error
- func (lu ConsistentLookupUnique) String() string
- func (lu ConsistentLookupUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lu ConsistentLookupUnique) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Hash
- func (cached *Hash) CachedSize(alloc bool) int64
- func (vind *Hash) Cost() int
- func (vind *Hash) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *Hash) IsUnique() bool
- func (vind *Hash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *Hash) NeedsVCursor() bool
- func (vind *Hash) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error)
- func (vind *Hash) String() string
- func (vind *Hash) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Hashing
- type Keyspace
- type KeyspaceSchema
- type Lookup
- type LookupBackfill
- type LookupHash
- func (lh *LookupHash) AllowBatch() bool
- func (lh *LookupHash) AutoCommitEnabled() bool
- func (cached *LookupHash) CachedSize(alloc bool) int64
- func (lh *LookupHash) Cost() int
- func (lh *LookupHash) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lh *LookupHash) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lh *LookupHash) GetCommitOrder() vtgatepb.CommitOrder
- func (lh *LookupHash) IsUnique() bool
- func (lh *LookupHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lh *LookupHash) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lh *LookupHash) MarshalJSON() ([]byte, error)
- func (lh *LookupHash) NeedsVCursor() bool
- func (lh *LookupHash) Query() (selQuery string, arguments []string)
- func (lh *LookupHash) String() string
- func (lh *LookupHash) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lh *LookupHash) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type LookupHashUnique
- func (lhu *LookupHashUnique) AllowBatch() bool
- func (lhu *LookupHashUnique) AutoCommitEnabled() bool
- func (cached *LookupHashUnique) CachedSize(alloc bool) int64
- func (lhu *LookupHashUnique) Cost() int
- func (lhu *LookupHashUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lhu *LookupHashUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lhu *LookupHashUnique) GetCommitOrder() vtgatepb.CommitOrder
- func (lhu *LookupHashUnique) IsBackfilling() bool
- func (lhu *LookupHashUnique) IsUnique() bool
- func (lhu *LookupHashUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lhu *LookupHashUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lhu *LookupHashUnique) MarshalJSON() ([]byte, error)
- func (lhu *LookupHashUnique) NeedsVCursor() bool
- func (lhu *LookupHashUnique) Query() (selQuery string, arguments []string)
- func (lhu *LookupHashUnique) String() string
- func (lhu *LookupHashUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lhu *LookupHashUnique) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type LookupNonUnique
- func (ln *LookupNonUnique) AllowBatch() bool
- func (ln *LookupNonUnique) AutoCommitEnabled() bool
- func (cached *LookupNonUnique) CachedSize(alloc bool) int64
- func (ln *LookupNonUnique) Cost() int
- func (ln *LookupNonUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (ln *LookupNonUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (ln *LookupNonUnique) GetCommitOrder() vtgatepb.CommitOrder
- func (ln *LookupNonUnique) IsUnique() bool
- func (ln *LookupNonUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (ln *LookupNonUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (ln *LookupNonUnique) MarshalJSON() ([]byte, error)
- func (ln *LookupNonUnique) NeedsVCursor() bool
- func (ln *LookupNonUnique) Query() (selQuery string, arguments []string)
- func (ln *LookupNonUnique) String() string
- func (ln *LookupNonUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (ln *LookupNonUnique) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type LookupPlanable
- type LookupUnicodeLooseMD5Hash
- func (lh *LookupUnicodeLooseMD5Hash) AllowBatch() bool
- func (lh *LookupUnicodeLooseMD5Hash) AutoCommitEnabled() bool
- func (cached *LookupUnicodeLooseMD5Hash) CachedSize(alloc bool) int64
- func (lh *LookupUnicodeLooseMD5Hash) Cost() int
- func (lh *LookupUnicodeLooseMD5Hash) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lh *LookupUnicodeLooseMD5Hash) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lh *LookupUnicodeLooseMD5Hash) GetCommitOrder() vtgatepb.CommitOrder
- func (lh *LookupUnicodeLooseMD5Hash) IsUnique() bool
- func (lh *LookupUnicodeLooseMD5Hash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lh *LookupUnicodeLooseMD5Hash) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lh *LookupUnicodeLooseMD5Hash) MarshalJSON() ([]byte, error)
- func (lh *LookupUnicodeLooseMD5Hash) NeedsVCursor() bool
- func (lh *LookupUnicodeLooseMD5Hash) Query() (selQuery string, arguments []string)
- func (lh *LookupUnicodeLooseMD5Hash) String() string
- func (lh *LookupUnicodeLooseMD5Hash) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lh *LookupUnicodeLooseMD5Hash) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type LookupUnicodeLooseMD5HashUnique
- func (lhu *LookupUnicodeLooseMD5HashUnique) AllowBatch() bool
- func (lhu *LookupUnicodeLooseMD5HashUnique) AutoCommitEnabled() bool
- func (cached *LookupUnicodeLooseMD5HashUnique) CachedSize(alloc bool) int64
- func (lhu *LookupUnicodeLooseMD5HashUnique) Cost() int
- func (lhu *LookupUnicodeLooseMD5HashUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lhu *LookupUnicodeLooseMD5HashUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lhu *LookupUnicodeLooseMD5HashUnique) GetCommitOrder() vtgatepb.CommitOrder
- func (lhu *LookupUnicodeLooseMD5HashUnique) IsBackfilling() bool
- func (lhu *LookupUnicodeLooseMD5HashUnique) IsUnique() bool
- func (lhu *LookupUnicodeLooseMD5HashUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lhu *LookupUnicodeLooseMD5HashUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lhu *LookupUnicodeLooseMD5HashUnique) MarshalJSON() ([]byte, error)
- func (lhu *LookupUnicodeLooseMD5HashUnique) NeedsVCursor() bool
- func (lhu *LookupUnicodeLooseMD5HashUnique) Query() (selQuery string, arguments []string)
- func (lhu *LookupUnicodeLooseMD5HashUnique) String() string
- func (lhu *LookupUnicodeLooseMD5HashUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lhu *LookupUnicodeLooseMD5HashUnique) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type LookupUnique
- func (lu *LookupUnique) AllowBatch() bool
- func (lu *LookupUnique) AutoCommitEnabled() bool
- func (cached *LookupUnique) CachedSize(alloc bool) int64
- func (lu *LookupUnique) Cost() int
- func (lu *LookupUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu *LookupUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) error
- func (lu *LookupUnique) GetCommitOrder() vtgatepb.CommitOrder
- func (lu *LookupUnique) IsBackfilling() bool
- func (lu *LookupUnique) IsUnique() bool
- func (lu *LookupUnique) LookupQuery() (string, error)
- func (lu *LookupUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (lu *LookupUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
- func (lu *LookupUnique) MarshalJSON() ([]byte, error)
- func (lu *LookupUnique) NeedsVCursor() bool
- func (lu *LookupUnique) Query() (string, []string)
- func (lu *LookupUnique) String() string
- func (lu *LookupUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, ...) error
- func (lu *LookupUnique) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type MultiCol
- func (cached *MultiCol) CachedSize(alloc bool) int64
- func (m *MultiCol) Cost() int
- func (m *MultiCol) IsUnique() bool
- func (m *MultiCol) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
- func (m *MultiCol) NeedsVCursor() bool
- func (m *MultiCol) PartialVindex() bool
- func (m *MultiCol) String() string
- func (m *MultiCol) Verify(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) ([]bool, error)
- type MultiColumn
- type NewVindexFunc
- type NotFoundError
- type Null
- func (cached *Null) CachedSize(alloc bool) int64
- func (vind *Null) Cost() int
- func (vind *Null) IsUnique() bool
- func (vind *Null) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *Null) NeedsVCursor() bool
- func (vind *Null) String() string
- func (vind *Null) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Numeric
- func (cached *Numeric) CachedSize(alloc bool) int64
- func (*Numeric) Cost() int
- func (*Numeric) Hash(id sqltypes.Value) ([]byte, error)
- func (*Numeric) IsUnique() bool
- func (vind *Numeric) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (*Numeric) NeedsVCursor() bool
- func (*Numeric) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error)
- func (vind *Numeric) String() string
- func (vind *Numeric) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type NumericLookupTable
- type NumericStaticMap
- func (cached *NumericStaticMap) CachedSize(alloc bool) int64
- func (*NumericStaticMap) Cost() int
- func (vind *NumericStaticMap) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *NumericStaticMap) IsUnique() bool
- func (vind *NumericStaticMap) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *NumericStaticMap) NeedsVCursor() bool
- func (vind *NumericStaticMap) String() string
- func (vind *NumericStaticMap) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Prefixable
- type RegionExperimental
- func (cached *RegionExperimental) CachedSize(alloc bool) int64
- func (ge *RegionExperimental) Cost() int
- func (ge *RegionExperimental) IsUnique() bool
- func (ge *RegionExperimental) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
- func (ge *RegionExperimental) NeedsVCursor() bool
- func (ge *RegionExperimental) PartialVindex() bool
- func (ge *RegionExperimental) String() string
- func (ge *RegionExperimental) Verify(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) ([]bool, error)
- type RegionJSON
- func (cached *RegionJSON) CachedSize(alloc bool) int64
- func (rv *RegionJSON) Cost() int
- func (rv *RegionJSON) IsUnique() bool
- func (rv *RegionJSON) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
- func (rv *RegionJSON) NeedsVCursor() bool
- func (rv *RegionJSON) PartialVindex() bool
- func (rv *RegionJSON) String() string
- func (rv *RegionJSON) Verify(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ...) ([]bool, error)
- type RegionMap
- type ReverseBits
- func (cached *ReverseBits) CachedSize(alloc bool) int64
- func (vind *ReverseBits) Cost() int
- func (vind *ReverseBits) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *ReverseBits) IsUnique() bool
- func (vind *ReverseBits) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *ReverseBits) NeedsVCursor() bool
- func (vind *ReverseBits) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error)
- func (vind *ReverseBits) String() string
- func (vind *ReverseBits) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type Reversible
- type RoutingRule
- type SingleColumn
- type Source
- type Table
- type UnicodeLooseMD5
- func (cached *UnicodeLooseMD5) CachedSize(alloc bool) int64
- func (vind *UnicodeLooseMD5) Cost() int
- func (vind *UnicodeLooseMD5) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *UnicodeLooseMD5) IsUnique() bool
- func (vind *UnicodeLooseMD5) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *UnicodeLooseMD5) NeedsVCursor() bool
- func (vind *UnicodeLooseMD5) String() string
- func (vind *UnicodeLooseMD5) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type UnicodeLooseXXHash
- func (cached *UnicodeLooseXXHash) CachedSize(alloc bool) int64
- func (vind *UnicodeLooseXXHash) Cost() int
- func (vind *UnicodeLooseXXHash) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *UnicodeLooseXXHash) IsUnique() bool
- func (vind *UnicodeLooseXXHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *UnicodeLooseXXHash) NeedsVCursor() bool
- func (vind *UnicodeLooseXXHash) String() string
- func (vind *UnicodeLooseXXHash) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
- type VCursor
- type VSchema
- func (vschema *VSchema) AddView(ksname string, viewName, query string) error
- func (vschema *VSchema) FindRoutedShard(keyspace, shard string) (string, error)
- func (vschema *VSchema) FindRoutedTable(keyspace, tablename string, tabletType topodatapb.TabletType) (*Table, error)
- func (vschema *VSchema) FindTable(keyspace, tablename string) (*Table, error)
- func (vschema *VSchema) FindTableOrVindex(keyspace, name string, tabletType topodatapb.TabletType) (*Table, Vindex, error)
- func (vschema *VSchema) FindView(keyspace, name string) sqlparser.SelectStatement
- func (vschema *VSchema) FindVindex(keyspace, name string) (Vindex, error)
- type Vindex
- func CreateVindex(vindexType, name string, params map[string]string) (Vindex, error)
- func NewBinary(name string, _ map[string]string) (Vindex, error)
- func NewBinaryMD5(name string, _ map[string]string) (Vindex, error)
- func NewCFC(name string, params map[string]string) (Vindex, error)
- func NewConsistentLookup(name string, m map[string]string) (Vindex, error)
- func NewConsistentLookupUnique(name string, m map[string]string) (Vindex, error)
- func NewHash(name string, _ map[string]string) (Vindex, error)
- func NewLookup(name string, m map[string]string) (Vindex, error)
- func NewLookupHash(name string, m map[string]string) (Vindex, error)
- func NewLookupHashUnique(name string, m map[string]string) (Vindex, error)
- func NewLookupUnicodeLooseMD5Hash(name string, m map[string]string) (Vindex, error)
- func NewLookupUnicodeLooseMD5HashUnique(name string, m map[string]string) (Vindex, error)
- func NewLookupUnique(name string, m map[string]string) (Vindex, error)
- func NewMultiCol(name string, m map[string]string) (Vindex, error)
- func NewNull(name string, m map[string]string) (Vindex, error)
- func NewNumeric(name string, _ map[string]string) (Vindex, error)
- func NewNumericStaticMap(name string, params map[string]string) (Vindex, error)
- func NewRegionExperimental(name string, m map[string]string) (Vindex, error)
- func NewRegionJSON(name string, m map[string]string) (Vindex, error)
- func NewReverseBits(name string, m map[string]string) (Vindex, error)
- func NewUnicodeLooseMD5(name string, _ map[string]string) (Vindex, error)
- func NewUnicodeLooseXXHash(name string, _ map[string]string) (Vindex, error)
- func NewXXHash(name string, _ map[string]string) (Vindex, error)
- type WantOwnerInfo
- type XXHash
- func (cached *XXHash) CachedSize(alloc bool) int64
- func (vind *XXHash) Cost() int
- func (vind *XXHash) Hash(id sqltypes.Value) ([]byte, error)
- func (vind *XXHash) IsUnique() bool
- func (vind *XXHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
- func (vind *XXHash) NeedsVCursor() bool
- func (vind *XXHash) String() string
- func (vind *XXHash) Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error)
Constants ¶
const ( TypeSequence = "sequence" TypeReference = "reference" )
The following constants represent table types.
Variables ¶
var TabletTypeSuffix = map[topodatapb.TabletType]string{
0: "@unknown",
1: "@primary",
2: "@replica",
3: "@rdonly",
4: "@spare",
5: "@experimental",
6: "@backup",
7: "@restore",
8: "@drained",
}
TabletTypeSuffix maps the tablet type to its suffix string.
Functions ¶
func ChooseVindexForType ¶
ChooseVindexForType chooses the most appropriate vindex for the give type.
func LoadFormal ¶
func LoadFormal(filename string) (*vschemapb.SrvVSchema, error)
LoadFormal loads the JSON representation of VSchema from a file.
func LoadFormalKeyspace ¶
LoadFormalKeyspace loads the JSON representation of VSchema from a file, for a single keyspace.
func Map ¶
func Map(ctx context.Context, vindex Vindex, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
Map invokes the Map implementation supplied by the vindex.
func NewKeyRangeFromPrefix ¶ added in v0.11.0
func NewKeyRangeFromPrefix(begin []byte) key.Destination
NewKeyRangeFromPrefix creates a keyspace range from a prefix of keyspace id.
func Register ¶
func Register(vindexType string, newVindexFunc NewVindexFunc)
Register registers a vindex under the specified vindexType. A duplicate vindexType will generate a panic. New vindexes will be created using these functions at the time of vschema loading.
func ValidateKeyspace ¶
ValidateKeyspace ensures that the keyspace vschema is valid. External references (like sequence) are not validated.
Types ¶
type AutoIncrement ¶
type AutoIncrement struct { Column sqlparser.IdentifierCI `json:"column"` Sequence *Table `json:"sequence"` }
AutoIncrement contains the auto-inc information for a table.
func (*AutoIncrement) CachedSize ¶ added in v0.10.0
func (cached *AutoIncrement) CachedSize(alloc bool) int64
type Binary ¶
type Binary struct {
// contains filtered or unexported fields
}
Binary is a vindex that converts binary bits to a keyspace id.
func (*Binary) CachedSize ¶ added in v0.10.0
func (*Binary) Map ¶
func (vind *Binary) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*Binary) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
func (*Binary) ReverseMap ¶
ReverseMap returns the associated ids for the ksids.
type BinaryMD5 ¶
type BinaryMD5 struct {
// contains filtered or unexported fields
}
BinaryMD5 is a vindex that hashes binary bits to a keyspace id.
func (*BinaryMD5) CachedSize ¶ added in v0.10.0
func (*BinaryMD5) Map ¶
func (vind *BinaryMD5) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*BinaryMD5) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
type ByCost ¶
type ByCost []*ColumnVindex
ByCost provides the interface needed for ColumnVindexes to be sorted by cost order.
type CFC ¶ added in v0.11.0
type CFC struct {
// contains filtered or unexported fields
}
CFC is Concatenated Fixed-width Composite Vindex.
The purpose of this vindex is to shard the rows based on the prefix of sharding key. Imagine the sharding key is defined as (s1, s2, ... sN), a prefix of this key is (s1, s2, ... sj) (j <= N). This vindex puts the rows with the same prefix among a same group of shards instead of scatter them around all the shards. The benefit of doing so is that prefix queries will only fanout to a subset of shards instead of all the shards. Specifically this vindex maps the full key, i.e. (s1, s2, ... sN) to a `key.DestinationKeyspaceID` and the prefix of it, i.e. (s1, s2, ... sj)(j<N) to a `key.DestinationKeyRange`. Note that the prefix to key range mapping is only active in 'LIKE' expression. When a column with CFC defined appears in other expressions, e.g. =, !=, IN etc, it behaves exactly as other functional unique vindexes.
This provides the capability to model hierarchical data models. If we consider the prefix as the 'parent' key and the full key as the 'child' key, all the child data is clustered within the same group of shards identified by the 'parent' key.
Due to the prevalance of using `vindexes.SingleColumn` in vindexes, it's way more complex to implement a true multi-column composite index (see github issue) than to implement it using a single column vindex where the components of the composite keys are concatenated together to form a single key. The user can use this single key directly as the keyspace id; one can also define a hash function so that the keyspace id is the concatenation of hash(s1), hash(s2), ... hash(sN). Using the concatenated key directly makes it easier to reason the fanout but the data distribution depends on the key itself; while using the hash on components takes care of the randomness of the data distribution.
Since the vindex is on a concatenated key, the offsets into the key are the only way to mark its components. Thus it implicitly requires each component to have a fixed width, except the last one. It's especially true when hash is defined. Because the hash is calculated component by component, only the prefix that aligns with the component boundary can be used to compute the key range. Although the misaligned part doesn't participate the key range calculation, the SQL executed on each shard uses the unchanged prefix; thus the behavior is exactly same as other vindex's but just more efficient in controlling the fanout.
The expected format of the vindex definition is ¶
"vindexes": { "cfc_md5": { "type": "cfc", "params": { "hash": "md5", "offsets": "[2,4]" } } }
'offsets' only makes sense when hash is used. Offsets should be a sorted list of positive ints, each of which denotes the byte offset (from the beginning of key) of each component's boundary in the concatenated key. Specifically, offsets[0] is the byte offset of the first component, offsets[1] is the byte offset of the second component, etc.
func (*CFC) CachedSize ¶ added in v0.11.0
func (*CFC) Cost ¶ added in v0.11.0
Cost returns the cost as 1. In regular mode, i.e. not in a LIKE op, CFC has pretty much the same cost as other unique vindexes like 'binary', 'md5' etc.
func (*CFC) NeedsVCursor ¶ added in v0.11.0
NeedsVCursor satisfies the Vindex interface.
func (*CFC) PrefixVindex ¶ added in v0.11.0
func (vind *CFC) PrefixVindex() SingleColumn
PrefixVindex switches the vindex to prefix mode
type Column ¶
type Column struct { Name sqlparser.IdentifierCI `json:"name"` Type querypb.Type `json:"type"` CollationName string `json:"collation_name"` }
Column describes a column.
func (*Column) CachedSize ¶ added in v0.10.0
func (*Column) MarshalJSON ¶
MarshalJSON returns a JSON representation of Column.
type ColumnVindex ¶
type ColumnVindex struct { Columns []sqlparser.IdentifierCI `json:"columns"` Type string `json:"type"` Name string `json:"name"` Owned bool `json:"owned,omitempty"` Vindex Vindex `json:"vindex"` // contains filtered or unexported fields }
ColumnVindex contains the index info for each index of a table.
func FindBestColVindex ¶
func FindBestColVindex(table *Table) (*ColumnVindex, error)
FindBestColVindex finds the best ColumnVindex for VReplication.
func FindVindexForSharding ¶
func FindVindexForSharding(tableName string, colVindexes []*ColumnVindex) (*ColumnVindex, error)
FindVindexForSharding searches through the given slice to find the lowest cost unique vindex primary vindex is always unique if two have the same cost, use the one that occurs earlier in the definition if the final result is too expensive, return nil
func (*ColumnVindex) CachedSize ¶ added in v0.10.0
func (cached *ColumnVindex) CachedSize(alloc bool) int64
func (*ColumnVindex) Cost ¶ added in v0.13.0
func (c *ColumnVindex) Cost() int
Cost represents the cost associated with using the ColumnVindex
func (*ColumnVindex) IsBackfilling ¶ added in v0.16.3
func (c *ColumnVindex) IsBackfilling() bool
IsBackfilling returns true if the vindex is in the process of backfilling the rows.
func (*ColumnVindex) IsPartialVindex ¶ added in v0.14.0
func (c *ColumnVindex) IsPartialVindex() bool
IsPartialVindex is used to let planner and engine know that this is a composite vindex missing one or more columns
func (*ColumnVindex) IsUnique ¶ added in v0.13.0
func (c *ColumnVindex) IsUnique() bool
IsUnique is used to tell whether the ColumnVindex will return a unique shard value or not when queried with the given column list
type ConsistentLookup ¶
type ConsistentLookup struct {
// contains filtered or unexported fields
}
ConsistentLookup is a non-unique lookup vindex that can stay consistent with respect to its owner table.
func (*ConsistentLookup) AllowBatch ¶ added in v0.15.0
func (lu *ConsistentLookup) AllowBatch() bool
AllowBatch implements the LookupPlanable interface
func (*ConsistentLookup) AutoCommitEnabled ¶ added in v0.15.3
func (lu *ConsistentLookup) AutoCommitEnabled() bool
func (*ConsistentLookup) CachedSize ¶ added in v0.10.0
func (cached *ConsistentLookup) CachedSize(alloc bool) int64
func (*ConsistentLookup) Cost ¶
func (lu *ConsistentLookup) Cost() int
Cost returns the cost of this vindex as 20.
func (ConsistentLookup) Create ¶
func (lu ConsistentLookup) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (ConsistentLookup) Delete ¶
func (lu ConsistentLookup) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (ConsistentLookup) GetCommitOrder ¶ added in v0.15.0
func (lu ConsistentLookup) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*ConsistentLookup) IsUnique ¶
func (lu *ConsistentLookup) IsUnique() bool
IsUnique returns false since the Vindex is non unique.
func (*ConsistentLookup) Map ¶
func (lu *ConsistentLookup) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*ConsistentLookup) MapResult ¶ added in v0.15.0
func (lu *ConsistentLookup) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (ConsistentLookup) MarshalJSON ¶
MarshalJSON returns a JSON representation of clCommon.
func (*ConsistentLookup) NeedsVCursor ¶
func (lu *ConsistentLookup) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*ConsistentLookup) Query ¶ added in v0.15.0
func (lu *ConsistentLookup) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (ConsistentLookup) SetOwnerInfo ¶
func (lu ConsistentLookup) SetOwnerInfo(keyspace, table string, cols []sqlparser.IdentifierCI) error
func (ConsistentLookup) String ¶
func (lu ConsistentLookup) String() string
String returns the name of the vindex.
type ConsistentLookupUnique ¶
type ConsistentLookupUnique struct {
// contains filtered or unexported fields
}
ConsistentLookupUnique defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup.
func (*ConsistentLookupUnique) AllowBatch ¶ added in v0.15.0
func (lu *ConsistentLookupUnique) AllowBatch() bool
AllowBatch implements the LookupPlanable interface
func (*ConsistentLookupUnique) AutoCommitEnabled ¶ added in v0.15.3
func (lu *ConsistentLookupUnique) AutoCommitEnabled() bool
func (*ConsistentLookupUnique) CachedSize ¶ added in v0.10.0
func (cached *ConsistentLookupUnique) CachedSize(alloc bool) int64
func (*ConsistentLookupUnique) Cost ¶
func (lu *ConsistentLookupUnique) Cost() int
Cost returns the cost of this vindex as 10.
func (ConsistentLookupUnique) Create ¶
func (lu ConsistentLookupUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (ConsistentLookupUnique) Delete ¶
func (lu ConsistentLookupUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (ConsistentLookupUnique) GetCommitOrder ¶ added in v0.15.0
func (lu ConsistentLookupUnique) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*ConsistentLookupUnique) IsBackfilling ¶ added in v0.12.0
func (lu *ConsistentLookupUnique) IsBackfilling() bool
IsBackfilling implements the LookupBackfill interface
func (*ConsistentLookupUnique) IsUnique ¶
func (lu *ConsistentLookupUnique) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*ConsistentLookupUnique) Map ¶
func (lu *ConsistentLookupUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*ConsistentLookupUnique) MapResult ¶ added in v0.15.0
func (lu *ConsistentLookupUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (ConsistentLookupUnique) MarshalJSON ¶
MarshalJSON returns a JSON representation of clCommon.
func (*ConsistentLookupUnique) NeedsVCursor ¶
func (lu *ConsistentLookupUnique) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*ConsistentLookupUnique) Query ¶ added in v0.15.0
func (lu *ConsistentLookupUnique) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (ConsistentLookupUnique) SetOwnerInfo ¶
func (lu ConsistentLookupUnique) SetOwnerInfo(keyspace, table string, cols []sqlparser.IdentifierCI) error
func (ConsistentLookupUnique) String ¶
func (lu ConsistentLookupUnique) String() string
String returns the name of the vindex.
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash defines vindex that hashes an int64 to a KeyspaceId by using null-key DES hash. It's Unique, Reversible and Functional. Note that at once stage we used a 3DES-based hash here, but for a null key as in our case, they are completely equivalent.
func (*Hash) CachedSize ¶ added in v0.10.0
func (*Hash) Map ¶
func (vind *Hash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*Hash) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
func (*Hash) ReverseMap ¶
ReverseMap returns the ids from ksids.
type Hashing ¶ added in v0.13.0
Hashing defined the interface for the vindexes that export the Hash function to be used by multi-column vindex.
type Keyspace ¶
Keyspace contains the keyspcae info for each Table.
func (*Keyspace) CachedSize ¶ added in v0.10.0
type KeyspaceSchema ¶
type KeyspaceSchema struct { Keyspace *Keyspace Tables map[string]*Table Vindexes map[string]Vindex Views map[string]sqlparser.SelectStatement Error error }
KeyspaceSchema contains the schema(table) for a keyspace.
func BuildKeyspaceSchema ¶
func BuildKeyspaceSchema(input *vschemapb.Keyspace, keyspace string) (*KeyspaceSchema, error)
BuildKeyspaceSchema builds the vschema portion for one keyspace. The build ignores sequence references because those dependencies can go cross-keyspace.
func (*KeyspaceSchema) MarshalJSON ¶
func (ks *KeyspaceSchema) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of KeyspaceSchema.
type Lookup ¶
type Lookup interface { // Create creates an association between ids and ksids. If ignoreMode // is true, then the Create should ignore dup key errors. Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error // Update replaces the mapping of old values with new values for a keyspace id. Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, newValues []sqltypes.Value) error }
A Lookup vindex is one that needs to lookup a previously stored map to compute the keyspace id from an id. This means that the creation of a lookup vindex entry requires a keyspace id as input. A Lookup vindex need not be unique because the keyspace_id, which must be supplied, can be used to determine the target shard for an insert operation.
type LookupBackfill ¶ added in v0.12.0
type LookupBackfill interface {
IsBackfilling() bool
}
LookupBackfill interfaces all lookup vindexes that can backfill rows, such as LookupUnique.
type LookupHash ¶
type LookupHash struct {
// contains filtered or unexported fields
}
LookupHash defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's NonUnique and a Lookup. Warning: This Vindex is being deprecated in favor of Lookup
func (*LookupHash) AllowBatch ¶ added in v0.15.0
func (lh *LookupHash) AllowBatch() bool
AllowBatch implements the LookupPlanable interface
func (*LookupHash) AutoCommitEnabled ¶ added in v0.15.3
func (lh *LookupHash) AutoCommitEnabled() bool
func (*LookupHash) CachedSize ¶ added in v0.10.0
func (cached *LookupHash) CachedSize(alloc bool) int64
func (*LookupHash) Cost ¶
func (lh *LookupHash) Cost() int
Cost returns the cost of this vindex as 20.
func (*LookupHash) Create ¶
func (lh *LookupHash) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupHash) Delete ¶
func (lh *LookupHash) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupHash) GetCommitOrder ¶ added in v0.15.0
func (lh *LookupHash) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*LookupHash) IsUnique ¶
func (lh *LookupHash) IsUnique() bool
IsUnique returns false since the Vindex is not unique.
func (*LookupHash) Map ¶
func (lh *LookupHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupHash) MapResult ¶ added in v0.15.0
func (lh *LookupHash) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (*LookupHash) MarshalJSON ¶
func (lh *LookupHash) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupHash.
func (*LookupHash) NeedsVCursor ¶
func (lh *LookupHash) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupHash) Query ¶ added in v0.15.0
func (lh *LookupHash) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (*LookupHash) String ¶
func (lh *LookupHash) String() string
String returns the name of the vindex.
type LookupHashUnique ¶
type LookupHashUnique struct {
// contains filtered or unexported fields
}
LookupHashUnique defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup. Warning: This Vindex is being depcreated in favor of LookupUnique
func (*LookupHashUnique) AllowBatch ¶ added in v0.15.0
func (lhu *LookupHashUnique) AllowBatch() bool
func (*LookupHashUnique) AutoCommitEnabled ¶ added in v0.15.3
func (lhu *LookupHashUnique) AutoCommitEnabled() bool
func (*LookupHashUnique) CachedSize ¶ added in v0.10.0
func (cached *LookupHashUnique) CachedSize(alloc bool) int64
func (*LookupHashUnique) Cost ¶
func (lhu *LookupHashUnique) Cost() int
Cost returns the cost of this vindex as 10.
func (*LookupHashUnique) Create ¶
func (lhu *LookupHashUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupHashUnique) Delete ¶
func (lhu *LookupHashUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupHashUnique) GetCommitOrder ¶ added in v0.15.0
func (lhu *LookupHashUnique) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*LookupHashUnique) IsBackfilling ¶ added in v0.12.0
func (lhu *LookupHashUnique) IsBackfilling() bool
IsBackfilling implements the LookupBackfill interface
func (*LookupHashUnique) IsUnique ¶
func (lhu *LookupHashUnique) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*LookupHashUnique) Map ¶
func (lhu *LookupHashUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupHashUnique) MapResult ¶ added in v0.15.0
func (lhu *LookupHashUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
func (*LookupHashUnique) MarshalJSON ¶
func (lhu *LookupHashUnique) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupHashUnique.
func (*LookupHashUnique) NeedsVCursor ¶
func (lhu *LookupHashUnique) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupHashUnique) Query ¶ added in v0.15.0
func (lhu *LookupHashUnique) Query() (selQuery string, arguments []string)
func (*LookupHashUnique) String ¶
func (lhu *LookupHashUnique) String() string
String returns the name of the vindex.
type LookupNonUnique ¶
type LookupNonUnique struct {
// contains filtered or unexported fields
}
LookupNonUnique defines a vindex that uses a lookup table and create a mapping between from ids and KeyspaceId. It's NonUnique and a Lookup.
func (*LookupNonUnique) AllowBatch ¶ added in v0.15.0
func (ln *LookupNonUnique) AllowBatch() bool
func (*LookupNonUnique) AutoCommitEnabled ¶ added in v0.15.3
func (ln *LookupNonUnique) AutoCommitEnabled() bool
func (*LookupNonUnique) CachedSize ¶ added in v0.10.0
func (cached *LookupNonUnique) CachedSize(alloc bool) int64
func (*LookupNonUnique) Cost ¶
func (ln *LookupNonUnique) Cost() int
Cost returns the cost of this vindex as 20.
func (*LookupNonUnique) Create ¶
func (ln *LookupNonUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupNonUnique) Delete ¶
func (ln *LookupNonUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupNonUnique) GetCommitOrder ¶ added in v0.15.0
func (ln *LookupNonUnique) GetCommitOrder() vtgatepb.CommitOrder
func (*LookupNonUnique) IsUnique ¶
func (ln *LookupNonUnique) IsUnique() bool
IsUnique returns false since the Vindex is non unique.
func (*LookupNonUnique) Map ¶
func (ln *LookupNonUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupNonUnique) MapResult ¶ added in v0.15.0
func (ln *LookupNonUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (*LookupNonUnique) MarshalJSON ¶
func (ln *LookupNonUnique) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupHash.
func (*LookupNonUnique) NeedsVCursor ¶
func (ln *LookupNonUnique) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupNonUnique) Query ¶ added in v0.15.0
func (ln *LookupNonUnique) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (*LookupNonUnique) String ¶
func (ln *LookupNonUnique) String() string
String returns the name of the vindex.
type LookupPlanable ¶ added in v0.15.0
type LookupPlanable interface { String() string Query() (selQuery string, arguments []string) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error) AllowBatch() bool GetCommitOrder() vtgatepb.CommitOrder AutoCommitEnabled() bool }
LookupPlanable are for lookup vindexes where we can extract the lookup query at plan time
type LookupUnicodeLooseMD5Hash ¶
type LookupUnicodeLooseMD5Hash struct {
// contains filtered or unexported fields
}
LookupUnicodeLooseMD5Hash defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's NonUnique and a Lookup and stores the from value in a hashed form. Warning: This Vindex is being depcreated in favor of Lookup
func (*LookupUnicodeLooseMD5Hash) AllowBatch ¶ added in v0.15.0
func (lh *LookupUnicodeLooseMD5Hash) AllowBatch() bool
AllowBatch implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5Hash) AutoCommitEnabled ¶ added in v0.15.3
func (lh *LookupUnicodeLooseMD5Hash) AutoCommitEnabled() bool
func (*LookupUnicodeLooseMD5Hash) CachedSize ¶ added in v0.10.0
func (cached *LookupUnicodeLooseMD5Hash) CachedSize(alloc bool) int64
func (*LookupUnicodeLooseMD5Hash) Cost ¶
func (lh *LookupUnicodeLooseMD5Hash) Cost() int
Cost returns the cost of this vindex as 20.
func (*LookupUnicodeLooseMD5Hash) Create ¶
func (lh *LookupUnicodeLooseMD5Hash) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupUnicodeLooseMD5Hash) Delete ¶
func (lh *LookupUnicodeLooseMD5Hash) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupUnicodeLooseMD5Hash) GetCommitOrder ¶ added in v0.15.0
func (lh *LookupUnicodeLooseMD5Hash) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5Hash) IsUnique ¶
func (lh *LookupUnicodeLooseMD5Hash) IsUnique() bool
IsUnique returns false since the Vindex is not unique.
func (*LookupUnicodeLooseMD5Hash) Map ¶
func (lh *LookupUnicodeLooseMD5Hash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupUnicodeLooseMD5Hash) MapResult ¶ added in v0.15.0
func (lh *LookupUnicodeLooseMD5Hash) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5Hash) MarshalJSON ¶
func (lh *LookupUnicodeLooseMD5Hash) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupHash.
func (*LookupUnicodeLooseMD5Hash) NeedsVCursor ¶
func (lh *LookupUnicodeLooseMD5Hash) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupUnicodeLooseMD5Hash) Query ¶ added in v0.15.0
func (lh *LookupUnicodeLooseMD5Hash) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5Hash) String ¶
func (lh *LookupUnicodeLooseMD5Hash) String() string
String returns the name of the vindex.
type LookupUnicodeLooseMD5HashUnique ¶
type LookupUnicodeLooseMD5HashUnique struct {
// contains filtered or unexported fields
}
LookupUnicodeLooseMD5HashUnique defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup and will store the from value in a hashed format. Warning: This Vindex is being depcreated in favor of LookupUnique
func (*LookupUnicodeLooseMD5HashUnique) AllowBatch ¶ added in v0.15.0
func (lhu *LookupUnicodeLooseMD5HashUnique) AllowBatch() bool
AllowBatch implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5HashUnique) AutoCommitEnabled ¶ added in v0.15.3
func (lhu *LookupUnicodeLooseMD5HashUnique) AutoCommitEnabled() bool
func (*LookupUnicodeLooseMD5HashUnique) CachedSize ¶ added in v0.10.0
func (cached *LookupUnicodeLooseMD5HashUnique) CachedSize(alloc bool) int64
func (*LookupUnicodeLooseMD5HashUnique) Cost ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) Cost() int
Cost returns the cost of this vindex as 10.
func (*LookupUnicodeLooseMD5HashUnique) Create ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupUnicodeLooseMD5HashUnique) Delete ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupUnicodeLooseMD5HashUnique) GetCommitOrder ¶ added in v0.15.0
func (lhu *LookupUnicodeLooseMD5HashUnique) GetCommitOrder() vtgatepb.CommitOrder
GetCommitOrder implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5HashUnique) IsBackfilling ¶ added in v0.12.0
func (lhu *LookupUnicodeLooseMD5HashUnique) IsBackfilling() bool
IsBackfilling implements the LookupBackfill interface
func (*LookupUnicodeLooseMD5HashUnique) IsUnique ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*LookupUnicodeLooseMD5HashUnique) Map ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupUnicodeLooseMD5HashUnique) MapResult ¶ added in v0.15.0
func (lhu *LookupUnicodeLooseMD5HashUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
MapResult implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5HashUnique) MarshalJSON ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupHashUnique.
func (*LookupUnicodeLooseMD5HashUnique) NeedsVCursor ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupUnicodeLooseMD5HashUnique) Query ¶ added in v0.15.0
func (lhu *LookupUnicodeLooseMD5HashUnique) Query() (selQuery string, arguments []string)
Query implements the LookupPlanable interface
func (*LookupUnicodeLooseMD5HashUnique) String ¶
func (lhu *LookupUnicodeLooseMD5HashUnique) String() string
String returns the name of the vindex.
type LookupUnique ¶
type LookupUnique struct {
// contains filtered or unexported fields
}
LookupUnique defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup.
func (*LookupUnique) AllowBatch ¶ added in v0.15.0
func (lu *LookupUnique) AllowBatch() bool
func (*LookupUnique) AutoCommitEnabled ¶ added in v0.15.3
func (lu *LookupUnique) AutoCommitEnabled() bool
func (*LookupUnique) CachedSize ¶ added in v0.10.0
func (cached *LookupUnique) CachedSize(alloc bool) int64
func (*LookupUnique) Cost ¶
func (lu *LookupUnique) Cost() int
Cost returns the cost of this vindex as 10.
func (*LookupUnique) Create ¶
func (lu *LookupUnique) Create(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte, ignoreMode bool) error
Create reserves the id by inserting it into the vindex table.
func (*LookupUnique) Delete ¶
func (lu *LookupUnique) Delete(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksid []byte) error
Delete deletes the entry from the vindex table.
func (*LookupUnique) GetCommitOrder ¶ added in v0.15.0
func (lu *LookupUnique) GetCommitOrder() vtgatepb.CommitOrder
func (*LookupUnique) IsBackfilling ¶ added in v0.12.0
func (lu *LookupUnique) IsBackfilling() bool
IsBackfilling implements the LookupBackfill interface
func (*LookupUnique) IsUnique ¶
func (lu *LookupUnique) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*LookupUnique) LookupQuery ¶ added in v0.15.0
func (lu *LookupUnique) LookupQuery() (string, error)
func (*LookupUnique) Map ¶
func (lu *LookupUnique) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*LookupUnique) MapResult ¶ added in v0.15.0
func (lu *LookupUnique) MapResult(ids []sqltypes.Value, results []*sqltypes.Result) ([]key.Destination, error)
func (*LookupUnique) MarshalJSON ¶
func (lu *LookupUnique) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of LookupUnique.
func (*LookupUnique) NeedsVCursor ¶
func (lu *LookupUnique) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*LookupUnique) Query ¶ added in v0.15.0
func (lu *LookupUnique) Query() (string, []string)
func (*LookupUnique) String ¶
func (lu *LookupUnique) String() string
String returns the name of the vindex.
type MultiCol ¶ added in v0.13.0
type MultiCol struct {
// contains filtered or unexported fields
}
func (*MultiCol) CachedSize ¶ added in v0.13.0
func (*MultiCol) NeedsVCursor ¶ added in v0.13.0
func (*MultiCol) PartialVindex ¶ added in v0.13.0
type MultiColumn ¶
type MultiColumn interface { Vindex Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error) Verify(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte) ([]bool, error) // PartialVindex returns true if subset of columns can be passed in to the vindex Map and Verify function. PartialVindex() bool }
MultiColumn defines the interface for a multi-column vindex.
type NewVindexFunc ¶
A NewVindexFunc is a function that creates a Vindex based on the properties specified in the input map. Every vindex must register a NewVindexFunc under a unique vindexType.
type NotFoundError ¶ added in v0.9.0
type NotFoundError struct {
TableName string
}
NotFoundError represents the error where the table name was not found
func (NotFoundError) Error ¶ added in v0.9.0
func (n NotFoundError) Error() string
type Null ¶
type Null struct {
// contains filtered or unexported fields
}
Null defines a vindex that always return 0. It's Unique and Functional. This is useful for rows that always go into the first shard. This Vindex can be used for validating an unsharded->sharded transition. Unlike other vindexes, this one will work even for NULL input values. This will allow you to keep MySQL auto-inc columns unchanged.
func (*Null) CachedSize ¶ added in v0.10.0
func (*Null) Map ¶
func (vind *Null) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*Null) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
type Numeric ¶
type Numeric struct {
// contains filtered or unexported fields
}
Numeric defines a bit-pattern mapping of a uint64 to the KeyspaceId. It's Unique and Reversible.
func (*Numeric) CachedSize ¶ added in v0.10.0
func (*Numeric) Map ¶
func (vind *Numeric) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*Numeric) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
func (*Numeric) ReverseMap ¶
ReverseMap returns the associated ids for the ksids.
type NumericLookupTable ¶
NumericLookupTable stores the mapping of keys.
type NumericStaticMap ¶
type NumericStaticMap struct {
// contains filtered or unexported fields
}
NumericStaticMap is similar to vindex Numeric but first attempts a lookup via a JSON file.
func (*NumericStaticMap) CachedSize ¶ added in v0.10.0
func (cached *NumericStaticMap) CachedSize(alloc bool) int64
func (*NumericStaticMap) Cost ¶
func (*NumericStaticMap) Cost() int
Cost returns the cost of this vindex as 1.
func (*NumericStaticMap) Hash ¶ added in v0.13.0
func (vind *NumericStaticMap) Hash(id sqltypes.Value) ([]byte, error)
func (*NumericStaticMap) IsUnique ¶
func (vind *NumericStaticMap) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*NumericStaticMap) Map ¶
func (vind *NumericStaticMap) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*NumericStaticMap) NeedsVCursor ¶
func (vind *NumericStaticMap) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*NumericStaticMap) String ¶
func (vind *NumericStaticMap) String() string
String returns the name of the vindex.
type Prefixable ¶ added in v0.11.0
type Prefixable interface { SingleColumn PrefixVindex() SingleColumn }
A Prefixable vindex is one that maps the prefix of a id to a keyspace range instead of a single keyspace id. It's being used to reduced the fan out for 'LIKE' expressions.
type RegionExperimental ¶
type RegionExperimental struct {
// contains filtered or unexported fields
}
RegionExperimental is a multi-column unique vindex. The first column is prefixed to the hash of the second column to produce the keyspace id. RegionExperimental can be used for geo-partitioning because the first column can denote a region, and its value will dictate the shard for that region.
func (*RegionExperimental) CachedSize ¶ added in v0.10.0
func (cached *RegionExperimental) CachedSize(alloc bool) int64
func (*RegionExperimental) Cost ¶
func (ge *RegionExperimental) Cost() int
Cost returns the cost of this index as 1.
func (*RegionExperimental) IsUnique ¶
func (ge *RegionExperimental) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*RegionExperimental) Map ¶
func (ge *RegionExperimental) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
Map satisfies MultiColumn.
func (*RegionExperimental) NeedsVCursor ¶
func (ge *RegionExperimental) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*RegionExperimental) PartialVindex ¶ added in v0.13.0
func (ge *RegionExperimental) PartialVindex() bool
func (*RegionExperimental) String ¶
func (ge *RegionExperimental) String() string
String returns the name of the vindex.
type RegionJSON ¶
type RegionJSON struct {
// contains filtered or unexported fields
}
RegionJSON is a multi-column unique vindex The first column is used to lookup the prefix part of the keyspace id, the second column is hashed, and the two values are combined to produce the keyspace id. RegionJson can be used for geo-partitioning because the first column can denote a region, and it will dictate the shard range for that region.
func (*RegionJSON) CachedSize ¶ added in v0.10.0
func (cached *RegionJSON) CachedSize(alloc bool) int64
func (*RegionJSON) Cost ¶
func (rv *RegionJSON) Cost() int
Cost returns the cost of this index as 1.
func (*RegionJSON) IsUnique ¶
func (rv *RegionJSON) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*RegionJSON) Map ¶
func (rv *RegionJSON) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error)
Map satisfies MultiColumn.
func (*RegionJSON) NeedsVCursor ¶
func (rv *RegionJSON) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*RegionJSON) PartialVindex ¶ added in v0.13.0
func (rv *RegionJSON) PartialVindex() bool
func (*RegionJSON) String ¶
func (rv *RegionJSON) String() string
String returns the name of the vindex.
type ReverseBits ¶
type ReverseBits struct {
// contains filtered or unexported fields
}
ReverseBits defines vindex that reverses the bits of a number. It's Unique, Reversible and Functional.
func (*ReverseBits) CachedSize ¶ added in v0.10.0
func (cached *ReverseBits) CachedSize(alloc bool) int64
func (*ReverseBits) Cost ¶
func (vind *ReverseBits) Cost() int
Cost returns the cost of this index as 1.
func (*ReverseBits) Hash ¶ added in v0.13.0
func (vind *ReverseBits) Hash(id sqltypes.Value) ([]byte, error)
func (*ReverseBits) IsUnique ¶
func (vind *ReverseBits) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*ReverseBits) Map ¶
func (vind *ReverseBits) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map returns the corresponding KeyspaceId values for the given ids.
func (*ReverseBits) NeedsVCursor ¶
func (vind *ReverseBits) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*ReverseBits) ReverseMap ¶
ReverseMap returns the ids from ksids.
func (*ReverseBits) String ¶
func (vind *ReverseBits) String() string
String returns the name of the vindex.
type Reversible ¶
type Reversible interface { SingleColumn ReverseMap(vcursor VCursor, ks [][]byte) ([]sqltypes.Value, error) }
A Reversible vindex is one that can perform a reverse lookup from a keyspace id to an id. This is optional. If present, VTGate can use it to fill column values based on the target keyspace id. Reversible is supported only for SingleColumn vindexes.
type RoutingRule ¶
RoutingRule represents one routing rule.
func (*RoutingRule) MarshalJSON ¶
func (rr *RoutingRule) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON representation of Column.
type SingleColumn ¶
type SingleColumn interface { Vindex // Map can map ids to key.Destination objects. // If the Vindex is unique, each id would map to either // a KeyRange, or a single KeyspaceID. // If the Vindex is non-unique, each id would map to either // a KeyRange, or a list of KeyspaceID. Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error) // Verify returns true for every id that successfully maps to the // specified keyspace id. Verify(ctx context.Context, vcursor VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error) }
SingleColumn defines the interface for a single column vindex.
type Source ¶ added in v0.16.0
func (*Source) CachedSize ¶ added in v0.16.0
type Table ¶
type Table struct { Type string `json:"type,omitempty"` Name sqlparser.IdentifierCS `json:"name"` Keyspace *Keyspace `json:"-"` ColumnVindexes []*ColumnVindex `json:"column_vindexes,omitempty"` Ordered []*ColumnVindex `json:"ordered,omitempty"` Owned []*ColumnVindex `json:"owned,omitempty"` AutoIncrement *AutoIncrement `json:"auto_increment,omitempty"` Columns []Column `json:"columns,omitempty"` Pinned []byte `json:"pinned,omitempty"` ColumnListAuthoritative bool `json:"column_list_authoritative,omitempty"` // ReferencedBy is an inverse mapping of tables in other keyspaces that // reference this table via Source. // // This is useful in route-planning for quickly selecting the optimal route // when JOIN-ing a reference table to a sharded table. ReferencedBy map[string]*Table `json:"-"` // Source is a keyspace-qualified table name that points to the source of a // reference table. Only applicable for tables with Type set to "reference". Source *Source `json:"source,omitempty"` }
Table represents a table in VSchema.
func (*Table) CachedSize ¶ added in v0.10.0
type UnicodeLooseMD5 ¶
type UnicodeLooseMD5 struct {
// contains filtered or unexported fields
}
UnicodeLooseMD5 is a vindex that normalizes and hashes unicode strings to a keyspace id. It conservatively converts the string to its base characters before hashing. This is also known as UCA level 1. Ref: http://www.unicode.org/reports/tr10/#Multi_Level_Comparison. This is compatible with MySQL's utf8_unicode_ci collation.
func (*UnicodeLooseMD5) CachedSize ¶ added in v0.10.0
func (cached *UnicodeLooseMD5) CachedSize(alloc bool) int64
func (*UnicodeLooseMD5) Hash ¶ added in v0.13.0
func (vind *UnicodeLooseMD5) Hash(id sqltypes.Value) ([]byte, error)
func (*UnicodeLooseMD5) IsUnique ¶
func (vind *UnicodeLooseMD5) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*UnicodeLooseMD5) Map ¶
func (vind *UnicodeLooseMD5) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*UnicodeLooseMD5) NeedsVCursor ¶
func (vind *UnicodeLooseMD5) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*UnicodeLooseMD5) String ¶
func (vind *UnicodeLooseMD5) String() string
String returns the name of the vindex.
type UnicodeLooseXXHash ¶ added in v0.8.0
type UnicodeLooseXXHash struct {
// contains filtered or unexported fields
}
UnicodeLooseXXHash is a vindex that normalizes and hashes unicode strings to a keyspace id. It conservatively converts the string to its base characters before hashing. This is also known as UCA level 1. Ref: http://www.unicode.org/reports/tr10/#Multi_Level_Comparison. This is compatible with MySQL's utf8_unicode_ci collation.
func (*UnicodeLooseXXHash) CachedSize ¶ added in v0.10.0
func (cached *UnicodeLooseXXHash) CachedSize(alloc bool) int64
func (*UnicodeLooseXXHash) Cost ¶ added in v0.8.0
func (vind *UnicodeLooseXXHash) Cost() int
Cost returns the cost as 1.
func (*UnicodeLooseXXHash) Hash ¶ added in v0.13.0
func (vind *UnicodeLooseXXHash) Hash(id sqltypes.Value) ([]byte, error)
func (*UnicodeLooseXXHash) IsUnique ¶ added in v0.8.0
func (vind *UnicodeLooseXXHash) IsUnique() bool
IsUnique returns true since the Vindex is unique.
func (*UnicodeLooseXXHash) Map ¶ added in v0.8.0
func (vind *UnicodeLooseXXHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*UnicodeLooseXXHash) NeedsVCursor ¶ added in v0.8.0
func (vind *UnicodeLooseXXHash) NeedsVCursor() bool
NeedsVCursor satisfies the Vindex interface.
func (*UnicodeLooseXXHash) String ¶ added in v0.8.0
func (vind *UnicodeLooseXXHash) String() string
String returns the name of the vindex.
type VCursor ¶
type VCursor interface { Execute(ctx context.Context, method string, query string, bindvars map[string]*querypb.BindVariable, rollbackOnError bool, co vtgatepb.CommitOrder) (*sqltypes.Result, error) ExecuteKeyspaceID(ctx context.Context, keyspace string, ksid []byte, query string, bindVars map[string]*querypb.BindVariable, rollbackOnError, autocommit bool) (*sqltypes.Result, error) InTransactionAndIsDML() bool LookupRowLockShardSession() vtgatepb.CommitOrder }
A VCursor is an interface that allows you to execute queries in the current context and session of a VTGate request. Vindexes can use this interface to execute lookup queries.
type VSchema ¶
type VSchema struct { RoutingRules map[string]*RoutingRule `json:"routing_rules"` Keyspaces map[string]*KeyspaceSchema `json:"keyspaces"` ShardRoutingRules map[string]string `json:"shard_routing_rules"` // contains filtered or unexported fields }
VSchema represents the denormalized version of SrvVSchema, used for building routing plans.
func BuildVSchema ¶
func BuildVSchema(source *vschemapb.SrvVSchema) (vschema *VSchema)
BuildVSchema builds a VSchema from a SrvVSchema.
func (*VSchema) FindRoutedShard ¶ added in v0.15.0
FindRoutedShard looks up shard routing rules and returns the target keyspace if applicable
func (*VSchema) FindRoutedTable ¶ added in v0.9.0
func (vschema *VSchema) FindRoutedTable(keyspace, tablename string, tabletType topodatapb.TabletType) (*Table, error)
FindRoutedTable finds a table checking the routing rules.
func (*VSchema) FindTable ¶
FindTable returns a pointer to the Table. If a keyspace is specified, only tables from that keyspace are searched. If the specified keyspace is unsharded and no tables matched, it's considered valid: FindTable will construct a table of that name and return it. If no keyspace is specified, then a table is returned only if its name is unique across all keyspaces. If there is only one keyspace in the vschema, and it's unsharded, then all table requests are considered valid and belonging to that keyspace. FindTable bypasses routing rules and returns at most one table.
func (*VSchema) FindTableOrVindex ¶ added in v0.8.0
func (vschema *VSchema) FindTableOrVindex(keyspace, name string, tabletType topodatapb.TabletType) (*Table, Vindex, error)
FindTableOrVindex finds a table or a Vindex by name using Find and FindVindex.
func (*VSchema) FindView ¶ added in v0.16.0
func (vschema *VSchema) FindView(keyspace, name string) sqlparser.SelectStatement
func (*VSchema) FindVindex ¶
FindVindex finds a vindex by name. If a keyspace is specified, only vindexes from that keyspace are searched. If no kesypace is specified, then a vindex is returned only if its name is unique across all keyspaces. The function returns an error only if the vindex name is ambiguous.
type Vindex ¶
type Vindex interface { // String returns the name of the Vindex instance. // It's used for testing and diagnostics. Use pointer // comparison to see if two objects refer to the same // Vindex. String() string // Cost is used by planbuilder to prioritize vindexes. // The cost can be 0 if the id is basically a keyspace id. // The cost can be 1 if the id can be hashed to a keyspace id. // The cost can be 2 or above if the id needs to be looked up // from an external data source. These guidelines are subject // to change in the future. Cost() int // IsUnique returns true if the Vindex is unique. // A Unique Vindex is allowed to return non-unique values like // a keyrange. This is in situations where the vindex does not // have enough information to map to a keyspace id. If so, such // a vindex cannot be primary. IsUnique() bool // NeedsVCursor returns true if the Vindex makes calls into the // VCursor. Such vindexes cannot be used by vreplication. NeedsVCursor() bool }
Vindex defines the interface required to register a vindex.
func CreateVindex ¶
CreateVindex creates a vindex of the specified type using the supplied params. The type must have been previously registered.
func NewBinaryMD5 ¶
NewBinaryMD5 creates a new BinaryMD5.
func NewConsistentLookup ¶
NewConsistentLookup creates a ConsistentLookup vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
func NewConsistentLookupUnique ¶
NewConsistentLookupUnique creates a ConsistentLookupUnique vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
func NewLookup ¶
NewLookup creates a LookupNonUnique vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause inserts to upsert and deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter. no_verify: in this mode, Verify will always succeed.
func NewLookupHash ¶
NewLookupHash creates a LookupHash vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause inserts to upsert and deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter.
func NewLookupHashUnique ¶
NewLookupHashUnique creates a LookupHashUnique vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter.
func NewLookupUnicodeLooseMD5Hash ¶
NewLookupUnicodeLooseMD5Hash creates a LookupUnicodeLooseMD5Hash vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause inserts to upsert and deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter.
func NewLookupUnicodeLooseMD5HashUnique ¶
NewLookupUnicodeLooseMD5HashUnique creates a LookupUnicodeLooseMD5HashUnique vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter.
func NewLookupUnique ¶
NewLookupUnique creates a LookupUnique vindex. The supplied map has the following required fields:
table: name of the backing table. It can be qualified by the keyspace. from: list of columns in the table that have the 'from' values of the lookup vindex. to: The 'to' column name of the table.
The following fields are optional:
autocommit: setting this to "true" will cause deletes to be ignored. write_only: in this mode, Map functions return the full keyrange causing a full scatter.
func NewMultiCol ¶ added in v0.13.0
NewMultiCol creates a new MultiCol.
func NewNumeric ¶
NewNumeric creates a Numeric vindex.
func NewNumericStaticMap ¶
NewNumericStaticMap creates a NumericStaticMap vindex.
func NewRegionExperimental ¶
NewRegionExperimental creates a RegionExperimental vindex. The supplied map requires all the fields of "consistent_lookup_unique". Additionally, it requires a region_bytes argument whose value can be "1", or "2".
func NewRegionJSON ¶
NewRegionJSON creates a RegionJson vindex. The supplied map requires all the fields of "RegionExperimental". Additionally, it requires a region_map argument representing the path to a json file containing a map of country to region.
func NewReverseBits ¶
NewReverseBits creates a new ReverseBits.
func NewUnicodeLooseMD5 ¶
NewUnicodeLooseMD5 creates a new UnicodeLooseMD5.
func NewUnicodeLooseXXHash ¶ added in v0.8.0
NewUnicodeLooseXXHash creates a new UnicodeLooseXXHash struct.
type WantOwnerInfo ¶
type WantOwnerInfo interface {
SetOwnerInfo(keyspace, table string, cols []sqlparser.IdentifierCI) error
}
WantOwnerInfo defines the interface that a vindex must satisfy to request info about the owner table. This information can be used to query the owner's table for the owning row's presence.
type XXHash ¶
type XXHash struct {
// contains filtered or unexported fields
}
XXHash defines vindex that hashes any sql types to a KeyspaceId by using xxhash64. It's Unique and works on any platform giving identical result.
func (*XXHash) CachedSize ¶ added in v0.10.0
func (*XXHash) Map ¶
func (vind *XXHash) Map(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]key.Destination, error)
Map can map ids to key.Destination objects.
func (*XXHash) NeedsVCursor ¶
NeedsVCursor satisfies the Vindex interface.
Source Files ¶
- binary.go
- binarymd5.go
- cached_size.go
- cfc.go
- consistent_lookup.go
- hash.go
- lookup.go
- lookup_hash.go
- lookup_internal.go
- lookup_unicodeloosemd5_hash.go
- multicol.go
- null.go
- numeric.go
- numeric_static_map.go
- region_experimental.go
- region_json.go
- reverse_bits.go
- unicode.go
- unicodeloosemd5.go
- unicodeloosexxhash.go
- vindex.go
- vschema.go
- xxhash.go