Documentation
¶
Index ¶
- Constants
- Variables
- type CallOption
- type CallOptions
- type Client
- type Option
- func Codec(contentType string, c codec.NewCodec) Option
- func ContentType(ct string) Option
- func DialTimeout(d time.Duration) Option
- func PoolSize(d int) Option
- func PoolTTL(d time.Duration) Option
- func Registry(r registry.Registry) Option
- func RequestTimeout(d time.Duration) Option
- func Retries(i int) Option
- func Selector(s selector.Selector) Option
- func Transport(t transport.Transport) Option
- type Options
- type Request
- type RequestOption
- type RequestOptions
- type Streamer
Constants ¶
View Source
const (
CLEAN_CHANNEL_SIZE = 64
)
Variables ¶
View Source
var ( // DefaultRetries is the default number of times a request is tried DefaultRetries = 1 // DefaultRequestTimeout is the default request timeout DefaultRequestTimeout = time.Second * 5 // DefaultPoolSize sets the connection pool size DefaultPoolSize = 0 // DefaultPoolTTL sets the connection pool ttl DefaultPoolTTL = time.Minute )
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(*CallOptions)
CallOption used by Call or Stream
func WithDialTimeout ¶
func WithDialTimeout(d time.Duration) CallOption
WithDialTimeout is a CallOption which overrides that which set in Options.CallOptions
func WithRequestTimeout ¶
func WithRequestTimeout(d time.Duration) CallOption
WithRequestTimeout is a CallOption which overrides that which set in Options.CallOptions
func WithRetries ¶
func WithRetries(i int) CallOption
WithRetries is a CallOption which overrides that which set in Options.CallOptions
type CallOptions ¶
type Client ¶
type Client interface {
Init(...Option) error
Options() Options
NewJsonRequest(service, method string, req interface{}, reqOpts ...RequestOption) Request
Call(ctx context.Context, req Request, rsp interface{}, opts ...CallOption) error
String() string
Close()
}
Client is the interface used to make requests to services. It supports Request/Response via Transport and Publishing via the Broker. It also supports bidiectional streaming of requests.
type Option ¶
type Option func(*Options)
Option used by the Client
func RequestTimeout ¶
The request timeout. Should this be a Call Option?
type Options ¶
type Options struct {
// Used to select codec
ContentType string
// Plugged interfaces
Codecs map[string]codec.NewCodec
Registry registry.Registry
Selector selector.Selector
Transport transport.Transport
// Connection Pool
PoolSize int
PoolTTL time.Duration
// Default Call Options
CallOptions CallOptions
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
type Request ¶
type Request interface {
Service() string
Method() string
ContentType() string
Request() interface{}
// indicates whether the request will be a streaming one rather than unary
Stream() bool
}
Request is the interface for a synchronous request used by Call or Stream
type RequestOption ¶
type RequestOption func(*RequestOptions)
RequestOption used by NewRequest
func StreamingRequest ¶
func StreamingRequest() RequestOption
type RequestOptions ¶
Click to show internal directories.
Click to hide internal directories.