envelope

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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