Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSourceID ¶
GetSourceID returns the source ID of the TiDB cluster that PD is belonged to.
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 NewMonotonicClock ¶
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