Documentation ¶
Overview ¶
Package raw provides the raw encoding for YARPC.
To make outbound requests,
client := raw.New(clientConfig) resBody, err := client.Call(ctx, "submit", []byte{1, 2, 3})
Use the Procedure function to build procedures to register against a Router.
func Submit(ctx context.Context, reqBody []byte) ([]byte, error) { // ... } dispatcher.Register(raw.Procedure("submit", Submit))
Similarly, use the OnewayProcedure function to build procedures to register against a Router.
func RunTask(ctx context.Context, reqBody []byte) error { // ... } dispatcher.Register(raw.OnewayProcedure("RunTask", RunTask))
Index ¶
Constants ¶
const Encoding transport.Encoding = "raw"
Encoding is the name of this encoding.
Variables ¶
This section is empty.
Functions ¶
func OnewayProcedure ¶ added in v0.4.0
func OnewayProcedure(name string, handler OnewayHandler) []transport.Procedure
OnewayProcedure builds a Procedure from the given raw handler
func Procedure ¶
func Procedure(name string, handler UnaryHandler) []transport.Procedure
Procedure builds a Procedure from the given raw handler.
func Register
deprecated
func Register(r transport.RouteTable, rs []transport.Procedure)
Register calls the RouteTable's Register method.
This function exists for backwards compatibility only. It will be removed in a future version.
Deprecated: Use the RouteTable's Register method directly.
Types ¶
type Client ¶
type Client interface { // Call performs a unary outbound Raw request. Call(ctx context.Context, procedure string, body []byte, opts ...yarpc.CallOption) ([]byte, error) // CallOneway performs a oneway outbound Raw request. CallOneway(ctx context.Context, procedure string, body []byte, opts ...yarpc.CallOption) (transport.Ack, error) }
Client makes Raw requests to a single service.
type OnewayHandler ¶ added in v0.4.0
OnewayHandler implements a single, onweway procedure