handler

package
v1.1.0-beta.0...-71d1252 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBName             = "db"
	HexKey             = "hexKey"
	IndexName          = "index"
	Handle             = "handle"
	RegionID           = "regionID"
	StartTS            = "startTS"
	TableName          = "table"
	TableID            = "tableID"
	ColumnID           = "colID"
	ColumnTp           = "colTp"
	ColumnFlag         = "colFlag"
	ColumnLen          = "colLen"
	RowBin             = "rowBin"
	Snapshot           = "snapshot"
	FileName           = "filename"
	DumpPartitionStats = "dumpPartitionStats"
	Begin              = "begin"
	End                = "end"
)
View Source
const (
	Type   = "type"
	IsDump = "isDump"

	// For extract plan task handler
	IsSkipStats   = "isSkipStats"
	IsHistoryView = "isHistoryView"
)

For extract task handler

View Source
const (
	TableIDQuery  = "table_id"
	TableIDsQuery = "table_ids"
	IDNameOnly    = "id_name_only"
	Limit         = "limit"
	JobID         = "start_job_id"
	Operation     = "op"
	Seconds       = "seconds"
)

For query string

View Source
const (
	HeaderContentType = "Content-Type"
	ContentTypeJSON   = "application/json"
)

Variables

This section is empty.

Functions

func ExtractTableAndPartitionName

func ExtractTableAndPartitionName(str string) (table, partition string)

ExtractTableAndPartitionName extracts table name and partition name from this "table(partition)":

func WriteData

func WriteData(w http.ResponseWriter, data any)

WriteData writes data to response.

func WriteError

func WriteError(w http.ResponseWriter, err error)

WriteError writes error to response.

Types

type ClusterUpgradeHandler

type ClusterUpgradeHandler struct {
	// contains filtered or unexported fields
}

ClusterUpgradeHandler is the handler for upgrading cluster.

func NewClusterUpgradeHandler

func NewClusterUpgradeHandler(store kv.Storage) *ClusterUpgradeHandler

NewClusterUpgradeHandler creates a new ClusterUpgradeHandler.

func (ClusterUpgradeHandler) FinishUpgrade

func (h ClusterUpgradeHandler) FinishUpgrade() (hasDone bool, err error)

FinishUpgrade is used to finish the upgrade.

func (ClusterUpgradeHandler) ServeHTTP

func (h ClusterUpgradeHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of ddl server info.

func (ClusterUpgradeHandler) StartUpgrade

func (h ClusterUpgradeHandler) StartUpgrade() (hasDone bool, err error)

StartUpgrade is used to start the upgrade.

type ClusterUpgradeInfo

type ClusterUpgradeInfo struct {
	ServersNum          int                `json:"servers_num,omitempty"`
	OwnerID             string             `json:"owner_id"`
	UpgradedPercent     int                `json:"upgraded_percent"`
	IsAllUpgraded       bool               `json:"is_all_server_version_consistent,omitempty"`
	AllServersDiffInfos []SimpleServerInfo `json:"all_servers_diff_info,omitempty"`
}

ClusterUpgradeInfo is used to report cluster upgrade info when do http request.

type RegionMeta

type RegionMeta struct {
	ID          uint64              `json:"region_id"`
	Leader      *metapb.Peer        `json:"leader"`
	Peers       []*metapb.Peer      `json:"peers"`
	RegionEpoch *metapb.RegionEpoch `json:"region_epoch"`
}

RegionMeta contains a region's peer detail

type SimpleServerInfo

type SimpleServerInfo struct {
	infosync.ServerVersionInfo
	ID           string `json:"ddl_id"`
	IP           string `json:"ip"`
	Port         uint   `json:"listening_port"`
	JSONServerID uint64 `json:"server_id"`
}

SimpleServerInfo is some simple information such as version and address.

type TikvHandlerTool

type TikvHandlerTool struct {
	helper.Helper
}

TikvHandlerTool is a tool to handle TiKV data.

func NewTikvHandlerTool

func NewTikvHandlerTool(store helper.Storage) *TikvHandlerTool

NewTikvHandlerTool creates a new TikvHandlerTool.

func (*TikvHandlerTool) GetHandle

func (t *TikvHandlerTool) GetHandle(tb table.PhysicalTable, params map[string]string, values url.Values) (kv.Handle, error)

GetHandle gets the handle of the record.

func (*TikvHandlerTool) GetMvccByIdxValue

func (t *TikvHandlerTool) GetMvccByIdxValue(idx table.Index, values url.Values, idxCols []*model.ColumnInfo, handle kv.Handle) ([]*helper.MvccKV, error)

GetMvccByIdxValue gets the mvcc by the index value.

func (*TikvHandlerTool) GetPartition

func (*TikvHandlerTool) GetPartition(tableVal table.Table, partitionName string) (table.PhysicalTable, error)

GetPartition gets the partition by the table and partition name.

func (*TikvHandlerTool) GetRegionIDByKey

func (t *TikvHandlerTool) GetRegionIDByKey(encodedKey []byte) (uint64, error)

GetRegionIDByKey gets the region id by the key.

func (*TikvHandlerTool) GetRegionsMeta

func (t *TikvHandlerTool) GetRegionsMeta(regionIDs []uint64) ([]RegionMeta, error)

GetRegionsMeta gets regions meta by regionIDs

func (*TikvHandlerTool) GetTable

func (t *TikvHandlerTool) GetTable(dbName, tableName string) (table.PhysicalTable, error)

GetTable gets the table by the database name and table name.

func (*TikvHandlerTool) GetTableID

func (t *TikvHandlerTool) GetTableID(dbName, tableName string) (int64, error)

GetTableID gets the table ID by the database name and table name.

func (*TikvHandlerTool) HandleMvccGetByHex

func (t *TikvHandlerTool) HandleMvccGetByHex(params map[string]string) (*mvccKV, error)

HandleMvccGetByHex handles the request of getting mvcc by hex encoded key.

func (*TikvHandlerTool) Schema

func (t *TikvHandlerTool) Schema() (infoschema.InfoSchema, error)

Schema gets the schema.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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