Back to

Package yarpc

Latest Go to latest

The highest tagged major version is .

Published: Dec 2, 2019 | License: MIT | Module:


func BadResponse

func BadResponse(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

BadResponse returns an object that's not a valid JSON response.

func EchoJSON

func EchoJSON(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

EchoJSON implements the echo procedure.

func EchoRaw

func EchoRaw(ctx context.Context, body []byte) ([]byte, error)

EchoRaw implements the echo/raw procedure.

func Sleep

func Sleep(ctx context.Context, body interface{}) (interface{}, error)

Sleep responds to json requests over any transport by sleeping for one second.

func SleepRaw

func SleepRaw(ctx context.Context, body []byte) ([]byte, error)

SleepRaw responds to raw requests over any transport by sleeping for one second.

func Start

func Start()

Start starts the test server that clients will make requests to

func Stop

func Stop()

Stop stops running the RPC test subject

func UnexpectedError

func UnexpectedError(ctx context.Context, body interface{}) (interface{}, error)

UnexpectedError fails with an unexpected error.

func WaitForTimeoutRaw

func WaitForTimeoutRaw(ctx context.Context, body []byte) ([]byte, error)

WaitForTimeoutRaw waits after the context deadline then returns the context error. yarpc should interpret this as an handler timeout, which in turns should be forwarded to the yarpc client as a remote handler timeout.

type EchoProtobuf

type EchoProtobuf struct{}

EchoProtobuf implements the Protobuf Echo service.

func (EchoProtobuf) Echo

func (EchoProtobuf) Echo(_ context.Context, request *crossdockpb.Ping) (*crossdockpb.Pong, error)

Echo implements the Echo function for the Protobuf Echo service.

type EchoThrift

type EchoThrift struct{}

EchoThrift implements the Thrift Echo service.

func (EchoThrift) Echo

func (EchoThrift) Echo(ctx context.Context, ping *echo.Ping) (*echo.Pong, error)

Echo endpoint for the Echo service.

type HTTPTransport

type HTTPTransport struct {
	Host string `json:"host"`
	Port int    `json:"port"`

HTTPTransport contains information about an HTTP transport.

type PhoneRequest

type PhoneRequest struct {
	Service   string          `json:"service"`
	Procedure string          `json:"procedure"`
	Transport TransportConfig `json:"transport"`
	Body      *js.RawMessage  `json:"body"`

PhoneRequest is a request to make another request to a different service.

type PhoneResponse

type PhoneResponse struct {
	Service   string         `json:"service"`
	Procedure string         `json:"procedure"`
	Body      *js.RawMessage `json:"body"`

PhoneResponse is the response of a Phone request.

func Phone

func Phone(ctx context.Context, body *PhoneRequest) (*PhoneResponse, error)

Phone implements the phone procedure

type TChannelTransport

type TChannelTransport struct {
	Host string `json:"host"`
	Port int    `json:"port"`

TChannelTransport contains information about a TChannel transport.

type TransportConfig

type TransportConfig struct {
	HTTP     *HTTPTransport     `json:"http"`
	TChannel *TChannelTransport `json:"tchannel"`

TransportConfig contains the transport configuration for the phone request.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier