Documentation ¶
Index ¶
- Constants
- Variables
- type CallOption
- type CallOptions
- type Client
- type Option
- func CodecType(t codec.CodecType) 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
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 DefaultRegistries = map[string]registry.NewRegistry{ "zookeeper": zookeeper.NewConsumerZookeeperRegistry, } DefaultSelectors = map[string]selector.NewSelector{ "cache": cache.NewSelector, } )
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 { Options() Options NewRequest(group, version, service, method string, args 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 bidirectional 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 CodecType codec.CodecType 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 // contains filtered or unexported fields }
type Request ¶
type Request interface { Options() RequestOptions Protocol() string Version() string Method() string Args() interface{} ContentType() string ServiceConfig() registry.ServiceConfigIf // 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.