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

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

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

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

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

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

func NewTransport(options ...TransportOption) *Transport

NewTransport returns a new Transport.

func (*Transport) IsRunning

func (t *Transport) IsRunning() bool

IsRunning implements transport.Lifecycle#IsRunning.

func (*Transport) NewInbound

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

NewInbound returns a new Inbound for the given listener.

func (*Transport) NewSingleOutbound

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

NewSingleOutbound returns a new Outbound for the given adrress.

func (*Transport) Start

func (t *Transport) Start() error

Start implements transport.Lifecycle#Start.

func (*Transport) Stop

func (t *Transport) Stop() error

Stop implements transport.Lifecycle#Stop.

type TransportConfig

type TransportConfig struct{}

TransportConfig configures a gRPC Transport.

This is currently just a placeholder.

type TransportOption

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