pdclient

package
v0.0.0-...-08b9edc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package pdclient provides a flexible PD API access to any PD instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcdClient

func NewEtcdClient(config EtcdClientConfig) (*clientv3.Client, error)

NewEtcdClient creates a new etcd client. The client must be closed by calling `client.Close()`. Returns error when config is invalid.

Types

type APIClient

type APIClient struct {
	*httpclient.Client
}

func NewAPIClient

func NewAPIClient(config httpclient.APIClientConfig) (*APIClient, error)

Returns error when config is invalid.

func (*APIClient) GetConfigReplicate

func (api *APIClient) GetConfigReplicate() (*GetConfigReplicateResponse, error)

func (*APIClient) GetHealth

func (api *APIClient) GetHealth() (*GetHealthResponse, error)

func (*APIClient) GetMembers

func (api *APIClient) GetMembers() (*GetMembersResponse, error)

func (*APIClient) GetStatus

func (api *APIClient) GetStatus() (*GetStatusResponse, error)

func (*APIClient) GetStores

func (api *APIClient) GetStores() (*GetStoresResponse, error)

func (*APIClient) HLGetLocationLabels

func (api *APIClient) HLGetLocationLabels() ([]string, error)

func (*APIClient) HLGetStoreLocations

func (api *APIClient) HLGetStoreLocations() (*StoreLocations, error)

func (*APIClient) HLGetStores

func (api *APIClient) HLGetStores() ([]GetStoresResponseStore, error)

type EtcdClientConfig

type EtcdClientConfig struct {
	Endpoints []string
	Context   context.Context
	TLS       *tls.Config
}

type GetConfigReplicateResponse

type GetConfigReplicateResponse struct {
	LocationLabels string `json:"location-labels"`
}

type GetHealthResponse

type GetHealthResponse []struct {
	MemberID uint64 `json:"member_id"`
	Health   bool   `json:"health"`
}

type GetMembersResponse

type GetMembersResponse struct {
	Members []struct {
		GitHash       string   `json:"git_hash"`
		ClientUrls    []string `json:"client_urls"`
		DeployPath    string   `json:"deploy_path"`
		BinaryVersion string   `json:"binary_version"`
		MemberID      uint64   `json:"member_id"`
	} `json:"members"`
}

type GetStatusResponse

type GetStatusResponse struct {
	StartTimestamp int64 `json:"start_timestamp"`
}

type GetStoresResponse

type GetStoresResponse struct {
	Stores []struct {
		Store GetStoresResponseStore
	} `json:"stores"`
}

type GetStoresResponseStore

type GetStoresResponseStore struct {
	Address string `json:"address"`
	ID      int    `json:"id"`
	Labels  []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"labels"`
	StateName      string `json:"state_name"`
	Version        string `json:"version"`
	StatusAddress  string `json:"status_address"`
	GitHash        string `json:"git_hash"`
	DeployPath     string `json:"deploy_path"`
	StartTimestamp int64  `json:"start_timestamp"`
}

type StoreLabels

type StoreLabels struct {
	Address string            `json:"address"`
	Labels  map[string]string `json:"labels"`
}

type StoreLocations

type StoreLocations struct {
	LocationLabels []string      `json:"location_labels"`
	Stores         []StoreLabels `json:"stores"`
}

Jump to

Keyboard shortcuts

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