Documentation ¶
Index ¶
- type BackoffFunc
- type CallFunc
- type CallOption
- type CallOptions
- type CallWrapper
- type Client
- type Message
- type MessageOption
- type MessageOptions
- type Option
- type Options
- type PublishOption
- type PublishOptions
- type Request
- type RequestOption
- type RequestOptions
- type Response
- type RetryFunc
- type Stream
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackoffFunc ¶
type CallFunc ¶
type CallFunc func(ctx context.Context, node *node.Node, req Request, rsp interface{}, opts CallOptions) error
CallFunc represents the individual call func
type CallOptions ¶
type CallWrapper ¶
CallWrapper is a low level wrapper for the CallFunc
type Client ¶
type Client interface { NewMessage(msg interface{}, opts ...MessageOption) Message NewRequest(service *service.Service, endpoint string, req interface{}, reqOpts ...RequestOption) Request Call(ctx context.Context, req Request, rsp interface{}, opts ...CallOption) error Publish(ctx context.Context, msg Message, opts ...PublishOption) error Stream(ctx context.Context, req Request, opts ...CallOption) (Stream, error) String() string }
Client client
var DefaultClient Client
DefaultClient implementation
type MessageOptions ¶
type MessageOptions struct {
ContentType string
}
type Option ¶
type Option func(*Options)
Option used by the Client
func ContentType ¶
ContentType Default content type of the client
type Options ¶
type Options struct { // Used to select codec ContentType string // Proxy address to send requests via Proxy string // Connection Pool PoolSize int PoolTTL time.Duration // 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 }
func NewOptions ¶
type PublishOptions ¶
type Request ¶
type Request interface { // Service The service to call Service() *service.Service // Method The action to take Method() string // Endpoint The endpoint to invoke Endpoint() string // ContentType The content type ContentType() string // Body The unencoded request body Body() interface{} // Codec Write to the encoded request writer. This is nil before a call is made Codec() codec.Codec // Stream 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 RequestOptions ¶
type Response ¶
type Response interface { // Codec Reader the response Codec() codec.Codec // Header read the header Header() map[string]string // Read the undecoded response Read() ([]byte, error) }
Response is the response received from a service
type RetryFunc ¶
RetryFunc note that returning either false or a non-nil error will result in the call not being retried
type Stream ¶
type Stream interface { // Context for the stream Context() context.Context // Request The request made Request() Request // Response The response read Response() Response // Send will encode and send a request Send(interface{}) error // Recv will decode and read a response Recv(interface{}) error // Error returns the stream error Error() error // Close closes the stream Close() error }
Stream is the interface for a bidirectional synchronous stream
Click to show internal directories.
Click to hide internal directories.