apiutil

package
v0.0.0-...-2cce608 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(scheme string, timeout time.Duration) *http.Client

NewHTTPClient returns a HTTP client according to the scheme.

func NewHTTPTransport

func NewHTTPTransport(scheme string) *http.Transport

NewHTTPTransport returns a proper http.RoundTripper.

func ReadJSON

func ReadJSON(r io.ReadCloser, data interface{}) error

ReadJSON reads a JSON data from r and then close it.

Types

type Client

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

Client is a client to access PD APIs.

func NewClient

func NewClient(addr string, timeout time.Duration) (*Client, error)

NewClient returns a client to access PD APIs.

func (*Client) GetClusterID

func (c *Client) GetClusterID() (uint64, error)

GetClusterID returns the Cluster ID.

func (*Client) GetLeader

func (c *Client) GetLeader() (*pdpb.Member, error)

GetLeader returns the PD leader info.

Jump to

Keyboard shortcuts

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