xrpc

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

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRpc        = errors.New("rpc is not available")
	ErrRpcTimeout = errors.New("rpc call timeout")
)
View Source
var (
	ErrNoClient = errors.New("rpc is not available")
)

Functions

This section is empty.

Types

type Client

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

Client is rpc client.

func Dial

func Dial(options ClientOptions) (c *Client)

Dial connects to an RPC server at the specified network address.

func (*Client) Call

func (c *Client) Call(serviceMethod string, args interface{}, reply interface{}) (err error)

Call invokes the named function, waits for it to complete, and returns its error status.

func (*Client) Close

func (c *Client) Close()

Close client connection.

func (*Client) Error

func (c *Client) Error() error

Return client error.

func (*Client) Ping

func (c *Client) Ping(serviceMethod string)

ping ping the rpc connect and reconnect when has an error.

type ClientOptions

type ClientOptions struct {
	Proto string
	Addr  string
}

Rpc client options.

type Clients

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

func Dials

func Dials(options []ClientOptions) *Clients

Dials connects to RPC servers at the specified network address.

func (*Clients) Available

func (c *Clients) Available() (err error)

has a available client.

func (*Clients) Call

func (c *Clients) Call(serviceMethod string, args interface{}, reply interface{}) (err error)

Call invokes the named function, waits for it to complete, and returns its error status. this include rpc.Client.Call method, and takes a timeout.

func (*Clients) Ping

func (c *Clients) Ping(serviceMethod string)

Ping the rpc connect and reconnect when has an error.

Jump to

Keyboard shortcuts

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