Documentation ¶
Index ¶
- Variables
- type CallOption
- type CallOptions
- type Client
- type Conn
- type Option
- func Backoff(b backoff.Backoff) Option
- func Breaker(b breaker.Builder) Option
- func Network(name string) Option
- func Registry(r registry.Registry) Option
- func Selector(b selector.Builder) Option
- func TLSConfig(c *tls.Config) Option
- func Timeout(d time.Duration) Option
- func Transport(t transport.Transport) Option
- type Options
- type Request
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{ Backoff: nil, Breaker: nil, Selector: nil, }
View Source
var ErrBreakerOpen = errors.New("circuit breaker is open")
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(*CallOptions)
func Codec ¶
func Codec(b codec.Builder) CallOption
func Retries ¶
func Retries(n int) CallOption
type CallOptions ¶
type Client ¶
type Client interface { // Init initializes the client using the given optional functions. // By default, the DefaultOptions will be used to create the client. Init(...Option) // Connect creates a virtual connection to a service. Note that only // the first call will open a new connection before which is closed. Connect(string) (Conn, error) // Stream returns a stream to a service endpoint. This method calls // Open to get a virtual connection in which the stream works. Stream(*Request, ...CallOption) (stream.Stream, error) // Invoke simply wraps Stream to make an unary call to the service. // TODO: Does it take too much to make such unary call by that?? Invoke(*Request, any, any, ...CallOption) error }
Client is a dynamic client that makes RPC calls to any service.
var Default Client
type Conn ¶
type Conn interface { // Open opens a stream to a specific service endpoint. Open(*http.Request, codec.Builder) (stream.Stream, error) // Close closes the virtual connection itself. Close() error }
Conn abstracts the virtual connection to a service.
type Options ¶
type Options struct { // Network specifies the network of the client itself. Network string // TLSConfig specifies the TLS configuration for dialer. TLSConfig *tls.Config // Timeout specifies a time limit for streams made by the client. Timeout time.Duration // Transport specifies a transport provider for communication. Transport transport.Transport // Registry specifies registry for service discovery. Registry registry.Registry // Backoff specifies a backoff implementation for retries. Backoff backoff.Backoff // Breaker specifies a circuit breaker builder. Breaker breaker.Builder // Selector specifies node selector builder. Selector selector.Builder }
Click to show internal directories.
Click to hide internal directories.