cse

package module
v0.0.0-...-1c8876a Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StoresRefreshInterval = time.Second * 5
	SyncRegionTimeout     = time.Second * 2
)
View Source
var (
	ErrRegionNotFound = errors.New("region not found")
)
View Source
var (
	TiKVSyncRegionDuration *prometheus.HistogramVec
)

Functions

func InitMetrics

func InitMetrics(namespace, subsystem string, constLabels map[string]string)

func NewClient

func NewClient(origin pd.Client, tlsConfig *tls.Config, cbOpt *CBOptions) (pd.Client, error)

func NewClientWithFallback

func NewClientWithFallback(client pd.Client, tlsConfig *tls.Config, cbOpt *CBOptions) (pd.Client, error)

func RegisterMetrics

func RegisterMetrics()

Types

type CBOptions

type CBOptions struct {
	Interval      time.Duration
	Timeout       time.Duration
	ProbeInterval time.Duration
	ReadyToTrip   func(counts gobreaker.Counts) bool
}

CBOptions is a wrapper for gobreaker settings.

type Client

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

func (*Client) Close

func (c *Client) Close()

func (*Client) GetAllStores

func (c *Client) GetAllStores(context.Context, ...pd.GetStoreOption) ([]*metapb.Store, error)

GetAllStores returns all stores in the cluster except tombstone stores.

func (*Client) GetPrevRegion

func (c *Client) GetPrevRegion(ctx context.Context, key []byte, _ ...pd.GetRegionOption) (*pd.Region, error)

func (*Client) GetRegion

func (c *Client) GetRegion(ctx context.Context, key []byte, _ ...pd.GetRegionOption) (*pd.Region, error)

func (*Client) GetRegionByID

func (c *Client) GetRegionByID(ctx context.Context, regionID uint64, _ ...pd.GetRegionOption) (*pd.Region, error)

func (*Client) GetStore

func (c *Client) GetStore(_ context.Context, storeID uint64) (*metapb.Store, error)

func (*Client) ScanRegions

func (c *Client) ScanRegions(ctx context.Context, startKey, endKey []byte, limit int, _ ...pd.GetRegionOption) ([]*pd.Region, error)

type ClientWithFallback

type ClientWithFallback struct {
	pd.Client
	// contains filtered or unexported fields
}

func (*ClientWithFallback) Close

func (f *ClientWithFallback) Close()

func (*ClientWithFallback) GetAllStores

func (f *ClientWithFallback) GetAllStores(ctx context.Context, opts ...pd.GetStoreOption) ([]*metapb.Store, error)

func (*ClientWithFallback) GetPrevRegion

func (f *ClientWithFallback) GetPrevRegion(ctx context.Context, key []byte, opts ...pd.GetRegionOption) (*pd.Region, error)

func (*ClientWithFallback) GetRegion

func (f *ClientWithFallback) GetRegion(ctx context.Context, key []byte, opts ...pd.GetRegionOption) (*pd.Region, error)

func (*ClientWithFallback) GetRegionByID

func (f *ClientWithFallback) GetRegionByID(ctx context.Context, regionID uint64, opts ...pd.GetRegionOption) (*pd.Region, error)

func (*ClientWithFallback) GetStore

func (f *ClientWithFallback) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, error)

func (*ClientWithFallback) ScanRegions

func (f *ClientWithFallback) ScanRegions(ctx context.Context, key, endKey []byte, limit int, opts ...pd.GetRegionOption) ([]*pd.Region, error)

type SyncRegionByIDRequest

type SyncRegionByIDRequest struct {
	RegionID uint64 `json:"region-id"`
}

type SyncRegionRequest

type SyncRegionRequest struct {
	Start   string `json:"start"`
	End     string `json:"end"`
	Limit   uint64 `json:"limit"`
	Reverse bool   `json:"reverse"`
}

Jump to

Keyboard shortcuts

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