rpc

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// OutboundPublicClient is the name of configured public client outbound
	OutboundPublicClient = "public-client"
)

Variables

This section is empty.

Functions

func IsGRPCOutbound added in v0.24.0

func IsGRPCOutbound(config transport.ClientConfig) bool

func ListenIP added in v0.24.0

func ListenIP() (net.IP, error)

ListenIP returns the IP to bind to in Listen. It tries to find an IP that can be used by other machines to reach this machine.

func NewDNSPeerChooserFactory added in v0.24.0

func NewDNSPeerChooserFactory(interval time.Duration, logger log.Logger) *dnsPeerChooserFactory

Types

type Factory added in v0.24.0

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

Factory is an implementation of common.RPCFactory interface

func NewFactory added in v0.24.0

func NewFactory(logger log.Logger, p Params) *Factory

NewFactory builds a new rpc.Factory

func (*Factory) GetChannel added in v0.24.0

func (d *Factory) GetChannel() tchannel.Channel

GetChannel returns Tchannel Channel used by Ringpop

func (*Factory) GetDispatcher added in v0.24.0

func (d *Factory) GetDispatcher() *yarpc.Dispatcher

GetDispatcher return a cached dispatcher

func (*Factory) GetMaxMessageSize added in v0.24.0

func (d *Factory) GetMaxMessageSize() int

type HeaderForwardingMiddleware added in v0.24.0

type HeaderForwardingMiddleware struct{}

HeaderForwardingMiddleware forwards headers from current inbound RPC call that is being handled to new outbound calls being made. If new value for the same header key is provided in the outbound request, keep it instead.

func (*HeaderForwardingMiddleware) Call added in v0.24.0

type InboundMetricsMiddleware added in v0.24.0

type InboundMetricsMiddleware struct{}

InboundMetricsMiddleware tags context with additional metric tags from incoming request.

func (*InboundMetricsMiddleware) Handle added in v0.24.0

type OutboundsBuilder added in v0.24.0

type OutboundsBuilder interface {
	Build(*grpc.Transport, *tchannel.Transport) (yarpc.Outbounds, error)
}

OutboundsBuilder allows defining outbounds for the dispatcher

func CombineOutbounds added in v0.24.0

func CombineOutbounds(builders ...OutboundsBuilder) OutboundsBuilder

CombineOutbounds takes multiple outbound builders and combines them

func NewCrossDCOutbounds added in v0.24.0

func NewCrossDCOutbounds(clusterGroup map[string]config.ClusterInformation, pcf PeerChooserFactory) OutboundsBuilder

func NewDirectOutbound added in v0.24.0

func NewDirectOutbound(serviceName string, grpcEnabled bool, tlsConfig *tls.Config) OutboundsBuilder

type Params added in v0.24.0

type Params struct {
	ServiceName     string
	TChannelAddress string
	GRPCAddress     string
	GRPCMaxMsgSize  int

	InboundTLS  *tls.Config
	OutboundTLS map[string]*tls.Config

	InboundMiddleware  yarpc.InboundMiddleware
	OutboundMiddleware yarpc.OutboundMiddleware

	OutboundsBuilder OutboundsBuilder
}

Params allows to configure rpc.Factory

func NewParams added in v0.24.0

func NewParams(serviceName string, config *config.Config, dc *dynamicconfig.Collection) (Params, error)

NewParams creates parameters for rpc.Factory from the given config

type PeerChooserFactory added in v0.24.0

type PeerChooserFactory interface {
	CreatePeerChooser(transport peer.Transport, address string) (peer.Chooser, error)
}

type ResponseInfo

type ResponseInfo struct {
	Size int
}

ResponseInfo structure is filled with data after the RPC call. It can be obtained with rpc.ContextWithResponseInfo function.

func ContextWithResponseInfo

func ContextWithResponseInfo(parent context.Context) (context.Context, *ResponseInfo)

ContextWithResponseInfo will create a child context that has ResponseInfo set as value. This value will get filled after the call is made and can be used later to retrieve some info of interest.

type ResponseInfoMiddleware

type ResponseInfoMiddleware struct{}

ResponseInfoMiddleware populates context with ResponseInfo structure which contains info about response that was received. In particular, it counts the size of the response in bytes. Such information can be useful down the line, where payload are deserialized and no longer have their size.

func (*ResponseInfoMiddleware) Call

Jump to

Keyboard shortcuts

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