rpc

package
v1.2.10-prerelease7 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const ComparatorYarpcKey = "cadence-visibility-override"

ComparatorYarpcKey is the const for yarpc key

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.

Types

type ClientPartitionConfigMiddleware added in v1.2.1

type ClientPartitionConfigMiddleware struct{}

ClientPartitionConfigMiddleware stores the partition config and isolation group of the request into the context It reads a header from client request and uses it as the isolation group

func (*ClientPartitionConfigMiddleware) Handle added in v1.2.1

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 ForwardPartitionConfigMiddleware added in v1.2.1

type ForwardPartitionConfigMiddleware struct{}

ForwardPartitionConfigMiddleware forwards the partition config to remote cluster The middleware should always be applied after any other middleware that inject partition config into the context so that it can overwrites the partition config into the context The purpose of this middleware is to make sure the partition config doesn't change when a request is forwarded from passive cluster to the active cluster

func (*ForwardPartitionConfigMiddleware) Call added in v1.2.1

func (*ForwardPartitionConfigMiddleware) Handle added in v1.2.1

type HeaderForwardingMiddleware added in v0.24.0

type HeaderForwardingMiddleware struct {
	// Rules are applied in order to add or remove headers by regex.
	//
	// There are no default rules, so by default no headers are copied.
	// To include headers by default, Add with a permissive regex and then remove specific ones.
	Rules []config.HeaderRule
}

HeaderForwardingMiddleware forwards headers from current inbound RPC call that is being handled to new outbound calls being made. As this does NOT differentiate between transports or purposes, it generally assumes we are not acting as a true proxy, so things like content lengths and encodings should not be forwarded - they will be provided by the outbound RPC library as needed.

Duplicated headers retain the first value only, matching how browsers and Go (afaict) generally behave.

This uses overly-simplified rules for choosing which headers are forwarded and which are not, intended to be lightly configurable. For a more in-depth logic review if it becomes needed, check:

There is likely no correct choice, as it depends on the recipients' behavior. If we need to support more complex logic, it's likely worth jumping to a fully-controllable thing. Middle-grounds will probably just need to be changed again later.

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
	HTTP            *httpParams

	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)
}

func NewDNSPeerChooserFactory added in v0.24.0

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

type PinotComparatorMiddleware added in v1.2.8

type PinotComparatorMiddleware struct{}

PinotComparatorMiddleware checks the header of a grpc request, and then override the context accordingly note: for Pinot Migration only (Jan. 2024)

func (*PinotComparatorMiddleware) Handle added in v1.2.8

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