grpc

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCallTimeout is the default call timeout.
	DefaultCallTimeout = 60 * time.Second
	// DefaultConnectTimeout is the default connect timeout.
	DefaultConnectTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Invoke(fileDescriptorSets []*descriptor.FileDescriptorSet, address string, method string, inputReader io.Reader, outputWriter io.Writer) error
}

Handler handles gRPC calls.

func NewHandler

func NewHandler(options ...HandlerOption) Handler

NewHandler returns a new Handler.

type HandlerOption

type HandlerOption func(*handler)

HandlerOption is an option for a new Handler.

func HandlerWithCallTimeout

func HandlerWithCallTimeout(callTimeout time.Duration) HandlerOption

HandlerWithCallTimeout returns a HandlerOption that has the given call timeout.

Each invocation must be completed within this time.

The default is to use DefaultCallTimeout.

func HandlerWithConnectTimeout

func HandlerWithConnectTimeout(connectTimeout time.Duration) HandlerOption

HandlerWithConnectTimeout returns a HandlerOption that has the given connect timeout.

The default is to use DefaultConnectTimeout.

func HandlerWithHeader

func HandlerWithHeader(key string, value string) HandlerOption

HandlerWithHeader returns a HandlerOption that adds the given key/value header.

func HandlerWithKeepaliveTime

func HandlerWithKeepaliveTime(keepaliveTime time.Duration) HandlerOption

HandlerWithKeepaliveTime returns a HandlerOption that has the given keepalive time.

The default is to have no keepalive time.

func HandlerWithLogger

func HandlerWithLogger(logger *zap.Logger) HandlerOption

HandlerWithLogger returns a HandlerOption that uses the given logger.

The default is to use zap.NewNop().

Jump to

Keyboard shortcuts

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