raw

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2016 License: MIT Imports: 7 Imported by: 0

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

View Source
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.

func New

func New(c transport.Channel) Client

New builds a new Raw client.

type OnewayHandler added in v0.4.0

type OnewayHandler func(context.Context, yarpc.ReqMeta, []byte) error

OnewayHandler implements a single, onweway procedure

type UnaryHandler added in v0.4.0

type UnaryHandler func(context.Context, yarpc.ReqMeta, []byte) ([]byte, yarpc.ResMeta, error)

UnaryHandler implements a single, unary procedure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL