raw

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 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},
)

To register a raw procedure, define a Registrant or use Procedure to make a single-function Registrant, and register it with Register.

func Submit(reqMeta yarpc.ReqMeta, reqBody []byte) ([]byte, yarpc.ResMeta, error) {
	// ...
}

raw.Register(dispatcher, raw.Procedure("submit", Submit))

Index

Constants

View Source
const Encoding transport.Encoding = "raw"

Encoding is the name of this encoding.

Variables

This section is empty.

Functions

func Register

func Register(reg transport.Registry, registrant Registrant)

Register registers the procedures defined by the given Registrant with the given Registry.

Types

type Client

type Client interface {
	// Call performs an outbound Raw request.
	Call(ctx context.Context, reqMeta yarpc.CallReqMeta, body []byte) ([]byte, yarpc.CallResMeta, error)
}

Client makes Raw requests to a single service.

func New

func New(c transport.Channel) Client

New builds a new Raw client.

type Handler

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

Handler implements a single procedure.

type Registrant

type Registrant interface {
	// contains filtered or unexported methods
}

Registrant is used for types that define or know about different Raw procedures.

func Procedure

func Procedure(name string, handler Handler) Registrant

Procedure builds a Registrant with a single procedure in it.

Jump to

Keyboard shortcuts

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