Versions in this module Expand all Collapse all v2 v2.9.3 Mar 12, 2021 v2.9.2 Mar 12, 2021 Changes in this version + var DefaultBackoff = exponentialBackoff + var DefaultClient Client = newRpcClient() + var DefaultCodecs = map[string]codec.NewCodec + var DefaultContentType = "application/protobuf" + var DefaultPoolSize = 100 + var DefaultPoolTTL = time.Minute + var DefaultRequestTimeout = time.Second * 5 + var DefaultRetries = 1 + var DefaultRetry = RetryOnError + var NewClient func(...Option) Client = newRpcClient + func Call(ctx context.Context, request Request, response interface{}, opts ...CallOption) error + func NewContext(ctx context.Context, c Client) context.Context + func Publish(ctx context.Context, msg Message, opts ...PublishOption) error + func RetryAlways(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func RetryOnError(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func String() string + type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error) + type Cache struct + func NewCache() *Cache + func (c *Cache) Get(ctx context.Context, req *Request) (interface{}, bool) + func (c *Cache) List() map[string]string + func (c *Cache) Set(ctx context.Context, req *Request, rsp interface{}, expiry time.Duration) + type CallFunc func(ctx context.Context, node *registry.Node, req Request, rsp interface{}, ...) error + type CallOption func(*CallOptions) + func WithAddress(a ...string) CallOption + func WithBackoff(fn BackoffFunc) CallOption + func WithCache(c time.Duration) CallOption + func WithCallWrapper(cw ...CallWrapper) CallOption + func WithDialTimeout(d time.Duration) CallOption + func WithRequestTimeout(d time.Duration) CallOption + func WithRetries(i int) CallOption + func WithRetry(fn RetryFunc) CallOption + func WithSelectOption(so ...selector.SelectOption) CallOption + func WithServiceToken() CallOption + func WithStreamTimeout(d time.Duration) CallOption + type CallOptions struct + Address []string + Backoff BackoffFunc + CacheExpiry time.Duration + CallWrappers []CallWrapper + Context context.Context + DialTimeout time.Duration + RequestTimeout time.Duration + Retries int + Retry RetryFunc + SelectOptions []selector.SelectOption + ServiceToken bool + StreamTimeout time.Duration + type CallWrapper func(CallFunc) CallFunc + type Client interface + Call func(ctx context.Context, req Request, rsp interface{}, opts ...CallOption) error + Init func(...Option) error + NewMessage func(topic string, msg interface{}, opts ...MessageOption) Message + NewRequest func(service, endpoint string, req interface{}, reqOpts ...RequestOption) Request + Options func() Options + Publish func(ctx context.Context, msg Message, opts ...PublishOption) error + Stream func(ctx context.Context, req Request, opts ...CallOption) (Stream, error) + String func() string + func FromContext(ctx context.Context) (Client, bool) + type Message interface + ContentType func() string + Payload func() interface{} + Topic func() string + func NewMessage(topic string, payload interface{}, opts ...MessageOption) Message + type MessageOption func(*MessageOptions) + func WithMessageContentType(ct string) MessageOption + type MessageOptions struct + ContentType string + type Option func(*Options) + func Backoff(fn BackoffFunc) Option + func Broker(b broker.Broker) 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 Retry(fn RetryFunc) Option + func Selector(s selector.Selector) Option + func StreamTimeout(d time.Duration) Option + func Transport(t transport.Transport) Option + func WithRouter(r Router) Option + func Wrap(w Wrapper) Option + func WrapCall(cw ...CallWrapper) Option + type Options struct + Broker broker.Broker + Cache *Cache + CallOptions CallOptions + Codecs map[string]codec.NewCodec + ContentType string + Context context.Context + PoolSize int + PoolTTL time.Duration + Registry registry.Registry + Router Router + Selector selector.Selector + Transport transport.Transport + Wrappers []Wrapper + func NewOptions(options ...Option) Options + type PublishOption func(*PublishOptions) + func PublishContext(ctx context.Context) PublishOption + func WithExchange(e string) PublishOption + type PublishOptions struct + Context context.Context + Exchange string + type Request interface + Body func() interface{} + Codec func() codec.Writer + ContentType func() string + Endpoint func() string + Method func() string + Service func() string + Stream func() bool + func NewRequest(service, endpoint string, request interface{}, reqOpts ...RequestOption) Request + type RequestOption func(*RequestOptions) + func StreamingRequest() RequestOption + func WithContentType(ct string) RequestOption + type RequestOptions struct + ContentType string + Context context.Context + Stream bool + type Response interface + Codec func() codec.Reader + Header func() map[string]string + Read func() ([]byte, error) + type RetryFunc func(ctx context.Context, req Request, retryCount int, err error) (bool, error) + type Router interface + SendRequest func(context.Context, Request) (Response, error) + type Stream interface + Close func() error + Context func() context.Context + Error func() error + Recv func(interface{}) error + Request func() Request + Response func() Response + Send func(interface{}) error + func NewStream(ctx context.Context, request Request, opts ...CallOption) (Stream, error) + type StreamWrapper func(Stream) Stream + type Wrapper func(Client) Client Other modules containing this package github.com/btccom/go-micro