Documentation ¶
Overview ¶
Package raw provides the raw encoding for YARPC.
To make outbound requests,
client := raw.New(channel) resBody, resMeta, err := client.Call( yarpc.NewReqMeta(ctx).Procedure("submit"), []byte{1, 2, 3}, )
Use the Procedure function to build registrants to register against a Registry.
func Submit(reqMeta yarpc.ReqMeta, reqBody []byte) ([]byte, yarpc.ResMeta, error) { // ... } dispatcher.Register(raw.Procedure("submit", Submit))
Similarly, use the OnewayProcedure function to build registrants to register against a Registry.
func RunTask(reqMeta yarpc.ReqMeta, 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.Registrant
OnewayProcedure builds a Registrant from the given raw handler
func Procedure ¶
func Procedure(name string, handler UnaryHandler) []transport.Registrant
Procedure builds a Registrant from the given raw handler.
func Register
deprecated
func Register(r transport.Registrar, rs []transport.Registrant)
Register calls the Registrar's Register method.
This function exists for backwards compatibility only. It will be removed in a future version.
Deprecated: Use the Registrar's Register method directly.
Types ¶
type Client ¶
type Client interface { // Call performs a unary outbound Raw request. Call(ctx context.Context, reqMeta yarpc.CallReqMeta, body []byte) ([]byte, yarpc.CallResMeta, error) // CallOneway performs a oneway outbound Raw request. CallOneway(ctx context.Context, reqMeta yarpc.CallReqMeta, body []byte) (transport.Ack, error) }
Client makes Raw requests to a single service.
type OnewayHandler ¶ added in v0.4.0
OnewayHandler implements a single, onweway procedure