pdutil

package
v0.0.0-...-1d14c1d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSourceID

func GetSourceID(ctx context.Context, pdClient pd.Client) (uint64, error)

GetSourceID returns the source ID of the TiDB cluster that PD is belonged to.

func NewClock

func NewClock(ctx context.Context, pdClient pd.Client) (*clock, error)

NewClock return a new clock

Types

type Clock

type Clock interface {
	// CurrentTime returns approximate current time from pd.
	CurrentTime() time.Time
	Run(ctx context.Context)
	Stop()
}

Clock is a time source of PD cluster.

func NewClock4Test

func NewClock4Test() Clock

NewClock4Test return a new clock for test.

func NewMonotonicClock

func NewMonotonicClock(pClock pclock.Clock) Clock

NewMonotonicClock return a new monotonic clock.

type ListServiceGCSafepoint

type ListServiceGCSafepoint struct {
	ServiceGCSafepoints []*ServiceSafePoint `json:"service_gc_safe_points"`
	GCSafePoint         uint64              `json:"gc_safe_point"`
}

ListServiceGCSafepoint is the response of pd list gc service safe point API

type PDAPIClient

type PDAPIClient interface {
	UpdateMetaLabel(ctx context.Context) error
	ListGcServiceSafePoint(ctx context.Context) (*ListServiceGCSafepoint, error)
	CollectMemberEndpoints(ctx context.Context) ([]string, error)
	Healthy(ctx context.Context, endpoint string) error
	ScanRegions(ctx context.Context, span tablepb.Span) ([]RegionInfo, error)
	Close()
}

PDAPIClient is client for PD http API.

func NewPDAPIClient

func NewPDAPIClient(pdClient pd.Client, conf *security.Credential) (PDAPIClient, error)

NewPDAPIClient create a new pdAPIClient.

type RegionInfo

type RegionInfo struct {
	ID          uint64 `json:"id"`
	StartKey    string `json:"start_key"`
	EndKey      string `json:"end_key"`
	WrittenKeys uint64 `json:"written_keys"`
}

RegionInfo records detail region info for api usage. NOTE: This type is a copy of github.com/tikv/pd/server/api.RegionInfo. To reduce dependency tree, we do not import the api package directly.

func NewTestRegionInfo

func NewTestRegionInfo(regionID uint64, start, end []byte, writtenKeys uint64) RegionInfo

NewTestRegionInfo creates a new RegionInfo for test purpose.

type RegionsInfo

type RegionsInfo struct {
	Count   int          `json:"count"`
	Regions []RegionInfo `json:"regions"`
}

RegionsInfo contains some regions with the detailed region info. NOTE: This type is a copy of github.com/tikv/pd/server/api.RegionInfo. To reduce dependency tree, we do not import the api package directly.

type ServiceSafePoint

type ServiceSafePoint struct {
	ServiceID string `json:"service_id"`
	ExpiredAt int64  `json:"expired_at"`
	SafePoint uint64 `json:"safe_point"`
}

ServiceSafePoint contains gc service safe point

Jump to

Keyboard shortcuts

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