raw

package
v1.34.5 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 3 Imported by: 100

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAppError = errors.New("application error")

ErrAppError is returned if the application sets an error response.

Functions

func Call

func Call(ctx context.Context, ch *tchannel.Channel, hostPort string, serviceName, method string,
	arg2, arg3 []byte) ([]byte, []byte, *tchannel.OutboundCallResponse, error)

Call makes a call to the given hostPort with the given arguments and returns the response args.

func CallSC

func CallSC(ctx context.Context, sc *tchannel.SubChannel, method string, arg2, arg3 []byte) (
	[]byte, []byte, *tchannel.OutboundCallResponse, error)

CallSC makes a call using the given subcahnnel

func ReadArgsV2

func ReadArgsV2(r tchannel.ArgReadable) ([]byte, []byte, error)

ReadArgsV2 reads arg2 and arg3 from a reader.

func Wrap

func Wrap(handler Handler) tchannel.Handler

Wrap wraps a Handler as a tchannel.Handler that can be passed to tchannel.Register.

func WriteArgs

func WriteArgs(call *tchannel.OutboundCall, arg2, arg3 []byte) ([]byte, []byte, *tchannel.OutboundCallResponse, error)

WriteArgs writes the given arguments to the call, and returns the response args.

func WriteResponse

func WriteResponse(response *tchannel.InboundCallResponse, resp *Res) error

WriteResponse writes the given Res to the InboundCallResponse.

Types

type Args

type Args struct {
	Caller string
	Format tchannel.Format
	Method string
	Arg2   []byte
	Arg3   []byte
}

Args parses the arguments from an incoming call req.

func ReadArgs

func ReadArgs(call *tchannel.InboundCall) (*Args, error)

ReadArgs reads the *Args from the given call.

type CArgs

type CArgs struct {
	Method      string
	Arg2        []byte
	Arg3        []byte
	CallOptions *tchannel.CallOptions
}

CArgs are the call arguments passed to CallV2.

type CRes

type CRes struct {
	Arg2     []byte
	Arg3     []byte
	AppError bool
}

CRes is the result of making a call.

func CallV2

func CallV2(ctx context.Context, sc *tchannel.SubChannel, cArgs CArgs) (*CRes, error)

CallV2 makes a call and does not attempt any retries.

type Handler

type Handler interface {
	// Handle is called on incoming calls, and contains all the arguments.
	// If an error is returned, it will set ApplicationError Arg3 will be the error string.
	Handle(ctx context.Context, args *Args) (*Res, error)
	OnError(ctx context.Context, err error)
}

Handler is the interface for a raw handler.

type Res

type Res struct {
	SystemErr error
	// IsErr is used to set an application error on the underlying call res.
	IsErr bool
	Arg2  []byte
	Arg3  []byte
}

Res represents the response to an incoming call req.

Jump to

Keyboard shortcuts

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