Documentation ¶
Overview ¶
Package client is an interface for an RPC client
Index ¶
- type CallFunc
- type CallOption
- type CallOptions
- type CallWrapper
- type Client
- type Option
- func Codec(contentType string, c codec.NewCodec) Option
- func Connector(ct connector.Connector) Option
- func ContentType(ct string) Option
- func Registry(r registry.Registry) Option
- func Selector(s selector.Selector) Option
- func Transport(t transport.Transport) Option
- func Wrap(w Wrapper) Option
- func WrapCall(cw ...CallWrapper) Option
- type Options
- type Request
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(*CallOptions)
CallOption used by Call or Stream
func WithCallWrapper ¶
func WithCallWrapper(cw ...CallWrapper) CallOption
WithCallWrapper is a CallOption which adds to the existing CallFunc wrappers
func WithSelectOption ¶
func WithSelectOption(so ...selector.SelectOption) CallOption
WithSelectOption select option
type CallOptions ¶
type CallOptions struct { SelectOptions []selector.SelectOption // Middleware for low level call func CallWrappers []CallWrapper // Other options for implementations of the interface // can be stored in a context Context context.Context }
CallOptions call options
type CallWrapper ¶
CallWrapper is a low level wrapper for the CallFunc
type Client ¶
type Client interface { Init(...Option) error Options() Options Handle(interface{}) error NewRequest(service, method string, req interface{}) Request Call(ctx context.Context, req Request, opts ...CallOption) error Broadcast(ctx context.Context, req Request, opts ...CallOption) String() string }
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 ContentType ¶
ContentType Default content type of the client
func WrapCall ¶
func WrapCall(cw ...CallWrapper) Option
WrapCall Adds a Wrapper to the list of CallFunc wrappers
type Options ¶
type Options struct { // Used to select codec ContentType string // Plugged interfaces Codecs map[string]codec.NewCodec Registry registry.Registry Selector selector.Selector Connector connector.Connector Transport transport.Transport // Middleware for client Wrappers []Wrapper // Default Call Options CallOptions CallOptions // Other options for implementations of the interface // can be stored in a context Context context.Context }
Options options
type Request ¶
type Request interface { // The request id ID() string // The service to call Service() string // The action to take Method() string // The content type ContentType() string // The unencoded request body Body() interface{} }
Request is the interface for a synchronous request used by Call or Stream