tidbproto

package
v0.0.0-...-08b9edc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIStr

type CIStr struct {
	O string `json:"O"` // Original string.
	L string `json:"L"` // Lower case string.
}

CIStr is case insensitive string.

type DBInfo

type DBInfo struct {
	ID    int64       `json:"id"`
	Name  CIStr       `json:"db_name"`
	State SchemaState `json:"state"`
}

DBInfo provides meta data describing a DB.

type IndexInfo

type IndexInfo struct {
	ID   int64 `json:"id"`
	Name CIStr `json:"idx_name"`
}

IndexInfo provides meta data describing a DB index. It corresponds to the statement `CREATE INDEX Name ON Table (Column);` See https://dev.mysql.com/doc/refman/5.7/en/create-index.html

type Key

type Key []byte

Key represents high-level TiDB Key type.

type KeyInfoBuffer

type KeyInfoBuffer []byte

KeyInfoBuffer can obtain the meta information of the TiDB Key. It can be reused, thereby reducing memory applications.

func (*KeyInfoBuffer) DecodeKey

func (buf *KeyInfoBuffer) DecodeKey(key Key) (KeyInfoBuffer, error)

DecodeKey obtains the KeyInfoBuffer from a TiDB Key

func (*KeyInfoBuffer) GenerateKey

func (buf *KeyInfoBuffer) GenerateKey(tableID, rowID int64) Key

GenerateTableKey generates a table split key.

func (KeyInfoBuffer) IndexInfo

func (buf KeyInfoBuffer) IndexInfo() (indexID int64)

IndexInfo returns the row ID of the key, if the key is not table key, returns 0.

func (KeyInfoBuffer) MetaOrTable

func (buf KeyInfoBuffer) MetaOrTable() (isMeta bool, tableID int64)

MetaOrTable checks if the key is a meta key or table key. If the key is a meta key, it returns true and 0. If the key is a table key, it returns false and table ID. Otherwise, it returns false and 0.

func (KeyInfoBuffer) RowInfo

func (buf KeyInfoBuffer) RowInfo() (isCommonHandle bool, rowID int64)

RowInfo returns the row ID of the key, if the key is not table key, returns 0.

type PartitionDefinition

type PartitionDefinition struct {
	ID   int64 `json:"id"`
	Name CIStr `json:"name"`
}

PartitionDefinition defines a single partition.

type PartitionInfo

type PartitionInfo struct {
	// User may already creates table with partition but table partition is not
	// yet supported back then. When Enable is true, write/read need use tid
	// rather than pid.
	Enable      bool                   `json:"enable"`
	Definitions []*PartitionDefinition `json:"definitions"`
}

PartitionInfo provides table partition info.

type SchemaState

type SchemaState byte

SchemaState is the state for schema elements.

const (
	// StateNone means this schema element is absent and can't be used.
	StateNone SchemaState = iota
	// StateDeleteOnly means we can only delete items for this schema element.
	StateDeleteOnly
	// StateWriteOnly means we can use any write operation on this schema element,
	// but outer can't read the changed data.
	StateWriteOnly
	// StateWriteReorganization means we are re-organizing whole data after write only state.
	StateWriteReorganization
	// StateDeleteReorganization means we are re-organizing whole data after delete only state.
	StateDeleteReorganization
	// StatePublic means this schema element is ok for all write and read operations.
	StatePublic
)

type TableInfo

type TableInfo struct {
	ID        int64          `json:"id"`
	Name      CIStr          `json:"name"`
	Indices   []*IndexInfo   `json:"index_info"`
	Partition *PartitionInfo `json:"partition"`
}

TableInfo provides meta data describing a DB table.

func (*TableInfo) GetPartitionInfo

func (t *TableInfo) GetPartitionInfo() *PartitionInfo

GetPartitionInfo returns the partition information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL