Back to godoc.org

Package envelope

v1.25.0
Latest Go to latest

The latest major version is .

Published: Sep 10, 2020 | License: MIT | Module: go.uber.org/thriftrw

Index

type Client

type Client interface {
	// Send sends a request to the method with the given name and body.
	Send(name string, body wire.Value) (wire.Value, error)
}

Client sends Thrift requests and returns their responses.

Client is thread-safe only if the underlying transport is thread-safe.

func NewClient

func NewClient(p protocol.Protocol, t Transport) Client

NewClient builds a new client which sends requests over the given transport, encoding them using the given protocol.

type ErrUnknownMethod

type ErrUnknownMethod string

ErrUnknownMethod is raised by Handlers to indicate that the given method is invalid.

func (ErrUnknownMethod) Error

func (e ErrUnknownMethod) Error() string

type Handler

type Handler interface {
	// Receives a request to the given method name and returns the response
	// body.
	//
	// Implementations should return ErrUnknownMethod if the method is invalid.
	Handle(name string, body wire.Value) (wire.Value, error)
}

Handler handles enveloped requests.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server allows a Handler to process bytes.

func NewServer

func NewServer(p protocol.Protocol, h Handler) Server

NewServer builds a new server.

func (Server) Handle

func (s Server) Handle(data []byte) ([]byte, error)

Handle handles the given binary payload.

type Transport

type Transport interface {
	Send([]byte) ([]byte, error)
}

Transport sends and receive binary payloads.

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