grpc

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package grpc implements the grpc transport.

This package is experimental and should not be used in production.

Index

Constants

View Source
const UserAgent = "yarpc-go/" + yarpc.Version

UserAgent is the User-Agent that will be set for requests. http://www.grpc.io/docs/guides/wire.html#user-agents

Variables

This section is empty.

Functions

func TransportSpec added in v1.9.0

func TransportSpec(opts ...Option) config.TransportSpec

TransportSpec returns a TransportSpec for the gRPC transport.

See TransportConfig, InboundConfig, and OutboundConfig for details on the different configuration parameters supported by this Transport.

Any TransportOption, InboundOption, or OutboundOption may be passed to this function. These options will be applied BEFORE configuration parameters are interpreted. This allows configuration parameters to override Options provided to TransportSpec.

Types

type Inbound

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

Inbound is a grpc transport.Inbound.

func (*Inbound) IsRunning

func (i *Inbound) IsRunning() bool

IsRunning implements transport.Lifecycle#IsRunning.

func (*Inbound) SetRouter

func (i *Inbound) SetRouter(router transport.Router)

SetRouter implements transport.Inbound#SetRouter.

func (*Inbound) Start

func (i *Inbound) Start() error

Start implements transport.Lifecycle#Start.

func (*Inbound) Stop

func (i *Inbound) Stop() error

Stop implements transport.Lifecycle#Stop.

func (*Inbound) Transports

func (i *Inbound) Transports() []transport.Transport

Transports implements transport.Inbound#Transports.

type InboundConfig added in v1.9.0

type InboundConfig struct {
	// Address to listen on. This field is required.
	Address string `config:"address,interpolate"`
}

InboundConfig configures a gRPC Inbound.

inbounds:

grpc:
  address: ":80"

type InboundOption

type InboundOption func(*inboundOptions)

InboundOption is an option for an inbound.

func WithInboundTracer

func WithInboundTracer(tracer opentracing.Tracer) InboundOption

WithInboundTracer specifies the tracer to use for an inbound.

type Option added in v1.9.0

type Option interface {
	// contains filtered or unexported methods
}

Option is an interface shared by TransportOption, InboundOption, and OutboundOption allowing either to be recognized by TransportSpec().

type Outbound

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

Outbound is a transport.UnaryOutbound.

func (*Outbound) Call

func (o *Outbound) Call(ctx context.Context, request *transport.Request) (*transport.Response, error)

Call implements transport.UnaryOutbound#Call.

func (*Outbound) IsRunning

func (o *Outbound) IsRunning() bool

IsRunning implements transport.Lifecycle#IsRunning.

func (*Outbound) Start

func (o *Outbound) Start() error

Start implements transport.Lifecycle#Start.

func (*Outbound) Stop

func (o *Outbound) Stop() error

Stop implements transport.Lifecycle#Stop.

func (*Outbound) Transports

func (o *Outbound) Transports() []transport.Transport

Transports implements transport.Inbound#Transports.

type OutboundConfig added in v1.9.0

type OutboundConfig struct {
	// Address to connect to. This field is required.
	Address string `config:"address,interpolate"`
}

OutboundConfig configures a gRPC Outbound.

outbounds:

myservice:
  grpc:
    address: ":80"

type OutboundOption

type OutboundOption func(*outboundOptions)

OutboundOption is an option for an outbound.

func WithOutboundTracer

func WithOutboundTracer(tracer opentracing.Tracer) OutboundOption

WithOutboundTracer specifies the tracer to use for an outbound.

type Transport added in v1.9.0

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

Transport is a grpc transport.Transport.

This currently does not have any additional functionality over creating an Inbound or Outbound separately, but may in the future.

func NewTransport added in v1.9.0

func NewTransport(options ...TransportOption) *Transport

NewTransport returns a new Transport.

func (*Transport) IsRunning added in v1.9.0

func (t *Transport) IsRunning() bool

IsRunning implements transport.Lifecycle#IsRunning.

func (*Transport) NewInbound added in v1.9.0

func (t *Transport) NewInbound(listener net.Listener, options ...InboundOption) *Inbound

NewInbound returns a new Inbound for the given listener.

func (*Transport) NewSingleOutbound added in v1.9.0

func (t *Transport) NewSingleOutbound(address string, options ...OutboundOption) *Outbound

NewSingleOutbound returns a new Outbound for the given adrress.

func (*Transport) Start added in v1.9.0

func (t *Transport) Start() error

Start implements transport.Lifecycle#Start.

func (*Transport) Stop added in v1.9.0

func (t *Transport) Stop() error

Stop implements transport.Lifecycle#Stop.

type TransportConfig added in v1.9.0

type TransportConfig struct{}

TransportConfig configures a gRPC Transport.

This is currently just a placeholder.

type TransportOption added in v1.9.0

type TransportOption func(*transportOptions)

TransportOption is an option for a transport.

Directories

Path Synopsis
Package grpcheader provides the headers functionality for gRPC.
Package grpcheader provides the headers functionality for gRPC.

Jump to

Keyboard shortcuts

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