Documentation ¶
Index ¶
- func CallPeer(ctx Context, peer *tchannel.Peer, serviceName, method string, ...) error
- func CallSC(ctx Context, sc *tchannel.SubChannel, method string, arg, resp interface{}) error
- func Register(registrar tchannel.Registrar, funcs Handlers, ...) error
- type Client
- type ClientOptions
- type Context
- type ErrApplication
- type Handlers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallPeer ¶
func CallPeer(ctx Context, peer *tchannel.Peer, serviceName, method string, arg, resp interface{}) error
CallPeer makes a JSON call using the given peer.
func Register ¶
func Register(registrar tchannel.Registrar, funcs Handlers, onError func(context.Context, error)) error
Register registers the specified methods specified as a map from method name to the JSON handler function. The handler functions should have the following signature: func(context.Context, *ArgType)(*ResType, error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to make JSON calls to other services.
func NewClient ¶
func NewClient(ch *tchannel.Channel, targetService string, opts *ClientOptions) *Client
NewClient returns a json.Client used to make outbound JSON calls.
type ClientOptions ¶
type ClientOptions struct {
HostPort string
}
ClientOptions are options used when creating a client.
type Context ¶
type Context tchannel.ContextWithHeaders
Context is a JSON Context which contains request and response headers.
func NewContext ¶
func NewContext(timeout time.Duration) (Context, context.CancelFunc)
NewContext returns a Context that can be used to make JSON calls.
func WithHeaders ¶
WithHeaders returns a Context that can be used to make a call with request headers.
type ErrApplication ¶
type ErrApplication map[string]interface{}
ErrApplication is an application error which contains the object returned from the other side.
func (ErrApplication) Error ¶
func (e ErrApplication) Error() string