pdutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a HTTP Client for PD.

func NewPDClient

func NewPDClient(c *http.Client, pdAddr string) *Client

NewPDClient creates a HTTP Client for PD.

func (*Client) AddScheduler

func (p *Client) AddScheduler(schedulerName string) error

AddScheduler adds the specified scheduler to PD.

func (*Client) GetRegionByKey

func (p *Client) GetRegionByKey(key string) (*RegionInfo, error)

GetRegionByKey gets the region info by region key.

func (*Client) GetSiblingRegions

func (p *Client) GetSiblingRegions(id uint64) ([]*RegionInfo, error)

GetSiblingRegions gets the siblings' region info.

func (*Client) GetStores

func (p *Client) GetStores() (*Stores, error)

GetStores gets PD stores information.

func (*Client) ListRegions

func (p *Client) ListRegions() ([]*RegionInfo, error)

ListRegions lists region infos.

func (*Client) Operators

func (p *Client) Operators(input map[string]interface{}) error

Operators sends PD operators request.

func (*Client) RemoveScheduler

func (p *Client) RemoveScheduler(schedulerName string) error

RemoveScheduler removes the specified scheduler from PD.

type RegionInfo

type RegionInfo struct {
	ID       uint64         `json:"id"`
	StartKey string         `json:"start_key"`
	EndKey   string         `json:"end_key"`
	Peers    []*metapb.Peer `json:"peers,omitempty"`
	Leader   *metapb.Peer   `json:"leader,omitempty"`
}

RegionInfo represents PD region info.

type StoreInfo

type StoreInfo struct {
	*metapb.Store `json:"store"`
}

StoreInfo represents PD store info.

type Stores

type Stores struct {
	Count  uint64       `json:"count"`
	Stores []*StoreInfo `json:"stores"`
}

Stores represents PD store response.

Jump to

Keyboard shortcuts

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