rpc

package
v1.2.15-prerelease02 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 42 Imported by: 1

Documentation

Overview

Package rpc is a generated GoMock package.

Package rpc is a generated GoMock package.

Package rpc is a generated GoMock package.

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 interface {
	GetDispatcher() *yarpc.Dispatcher
	GetMaxMessageSize() int
	Start(PeerLister) error
	GetTChannel() tchannel.Channel
	Stop() error
}

Factory Creates a dispatcher that knows how to transport requests.

type FactoryImpl added in v1.2.14

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

Factory is an implementation of rpc.Factory interface

func NewFactory added in v0.24.0

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

NewFactory builds a new rpc.Factory

func (*FactoryImpl) GetDispatcher added in v1.2.14

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

GetDispatcher return a cached dispatcher

func (*FactoryImpl) GetMaxMessageSize added in v1.2.14

func (d *FactoryImpl) GetMaxMessageSize() int

func (*FactoryImpl) GetTChannel added in v1.2.14

func (d *FactoryImpl) GetTChannel() tchannel.Channel

GetChannel returns Tchannel Channel used by Ringpop

func (*FactoryImpl) Start added in v1.2.14

func (d *FactoryImpl) Start(peerLister PeerLister) error

func (*FactoryImpl) Stop added in v1.2.14

func (d *FactoryImpl) Stop() error

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 MockFactory added in v1.2.14

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

MockFactory is a mock of Factory interface.

func NewMockFactory added in v1.2.14

func NewMockFactory(ctrl *gomock.Controller) *MockFactory

NewMockFactory creates a new mock instance.

func (*MockFactory) EXPECT added in v1.2.14

func (m *MockFactory) EXPECT() *MockFactoryMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFactory) GetDispatcher added in v1.2.14

func (m *MockFactory) GetDispatcher() *yarpc.Dispatcher

GetDispatcher mocks base method.

func (*MockFactory) GetMaxMessageSize added in v1.2.14

func (m *MockFactory) GetMaxMessageSize() int

GetMaxMessageSize mocks base method.

func (*MockFactory) GetTChannel added in v1.2.14

func (m *MockFactory) GetTChannel() tchannel.Channel

GetTChannel mocks base method.

func (*MockFactory) Start added in v1.2.14

func (m *MockFactory) Start(arg0 PeerLister) error

Start mocks base method.

func (*MockFactory) Stop added in v1.2.14

func (m *MockFactory) Stop() error

Stop mocks base method.

type MockFactoryMockRecorder added in v1.2.14

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

MockFactoryMockRecorder is the mock recorder for MockFactory.

func (*MockFactoryMockRecorder) GetDispatcher added in v1.2.14

func (mr *MockFactoryMockRecorder) GetDispatcher() *gomock.Call

GetDispatcher indicates an expected call of GetDispatcher.

func (*MockFactoryMockRecorder) GetMaxMessageSize added in v1.2.14

func (mr *MockFactoryMockRecorder) GetMaxMessageSize() *gomock.Call

GetMaxMessageSize indicates an expected call of GetMaxMessageSize.

func (*MockFactoryMockRecorder) GetTChannel added in v1.2.14

func (mr *MockFactoryMockRecorder) GetTChannel() *gomock.Call

GetTChannel indicates an expected call of GetTChannel.

func (*MockFactoryMockRecorder) Start added in v1.2.14

func (mr *MockFactoryMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start.

func (*MockFactoryMockRecorder) Stop added in v1.2.14

func (mr *MockFactoryMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop.

type MockOutboundsBuilder added in v1.2.14

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

MockOutboundsBuilder is a mock of OutboundsBuilder interface.

func NewMockOutboundsBuilder added in v1.2.14

func NewMockOutboundsBuilder(ctrl *gomock.Controller) *MockOutboundsBuilder

NewMockOutboundsBuilder creates a new mock instance.

func (*MockOutboundsBuilder) Build added in v1.2.14

Build mocks base method.

func (*MockOutboundsBuilder) EXPECT added in v1.2.14

EXPECT returns an object that allows the caller to indicate expected use.

type MockOutboundsBuilderMockRecorder added in v1.2.14

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

MockOutboundsBuilderMockRecorder is the mock recorder for MockOutboundsBuilder.

func (*MockOutboundsBuilderMockRecorder) Build added in v1.2.14

func (mr *MockOutboundsBuilderMockRecorder) Build(arg0, arg1 interface{}) *gomock.Call

Build indicates an expected call of Build.

type MockPeerChooser

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

MockPeerChooser is a mock of PeerChooser interface.

func NewMockPeerChooser

func NewMockPeerChooser(ctrl *gomock.Controller) *MockPeerChooser

NewMockPeerChooser creates a new mock instance.

func (*MockPeerChooser) Choose

func (m *MockPeerChooser) Choose(arg0 context.Context, arg1 *transport.Request) (peer.Peer, func(error), error)

Choose mocks base method.

func (*MockPeerChooser) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPeerChooser) IsRunning

func (m *MockPeerChooser) IsRunning() bool

IsRunning mocks base method.

func (*MockPeerChooser) Start

func (m *MockPeerChooser) Start() error

Start mocks base method.

func (*MockPeerChooser) Stop

func (m *MockPeerChooser) Stop() error

Stop mocks base method.

func (*MockPeerChooser) UpdatePeers

func (m *MockPeerChooser) UpdatePeers(serviceName string, members []membership.HostInfo)

UpdatePeers mocks base method.

type MockPeerChooserFactory

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

MockPeerChooserFactory is a mock of PeerChooserFactory interface.

func NewMockPeerChooserFactory

func NewMockPeerChooserFactory(ctrl *gomock.Controller) *MockPeerChooserFactory

NewMockPeerChooserFactory creates a new mock instance.

func (*MockPeerChooserFactory) CreatePeerChooser

func (m *MockPeerChooserFactory) CreatePeerChooser(transport peer.Transport, opts PeerChooserOptions) (PeerChooser, error)

CreatePeerChooser mocks base method.

func (*MockPeerChooserFactory) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockPeerChooserFactoryMockRecorder

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

MockPeerChooserFactoryMockRecorder is the mock recorder for MockPeerChooserFactory.

func (*MockPeerChooserFactoryMockRecorder) CreatePeerChooser

func (mr *MockPeerChooserFactoryMockRecorder) CreatePeerChooser(transport, opts interface{}) *gomock.Call

CreatePeerChooser indicates an expected call of CreatePeerChooser.

type MockPeerChooserMockRecorder

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

MockPeerChooserMockRecorder is the mock recorder for MockPeerChooser.

func (*MockPeerChooserMockRecorder) Choose

func (mr *MockPeerChooserMockRecorder) Choose(arg0, arg1 interface{}) *gomock.Call

Choose indicates an expected call of Choose.

func (*MockPeerChooserMockRecorder) IsRunning

func (mr *MockPeerChooserMockRecorder) IsRunning() *gomock.Call

IsRunning indicates an expected call of IsRunning.

func (*MockPeerChooserMockRecorder) Start

Start indicates an expected call of Start.

func (*MockPeerChooserMockRecorder) Stop

Stop indicates an expected call of Stop.

func (*MockPeerChooserMockRecorder) UpdatePeers

func (mr *MockPeerChooserMockRecorder) UpdatePeers(serviceName, members interface{}) *gomock.Call

UpdatePeers indicates an expected call of UpdatePeers.

type MockPeerLister added in v1.2.14

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

MockPeerLister is a mock of PeerLister interface.

func NewMockPeerLister added in v1.2.14

func NewMockPeerLister(ctrl *gomock.Controller) *MockPeerLister

NewMockPeerLister creates a new mock instance.

func (*MockPeerLister) EXPECT added in v1.2.14

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPeerLister) Members added in v1.2.14

func (m *MockPeerLister) Members(service string) ([]membership.HostInfo, error)

Members mocks base method.

func (*MockPeerLister) Subscribe added in v1.2.14

func (m *MockPeerLister) Subscribe(service, name string, notifyChannel chan<- *membership.ChangedEvent) error

Subscribe mocks base method.

func (*MockPeerLister) Unsubscribe added in v1.2.14

func (m *MockPeerLister) Unsubscribe(service, name string) error

Unsubscribe mocks base method.

type MockPeerListerMockRecorder added in v1.2.14

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

MockPeerListerMockRecorder is the mock recorder for MockPeerLister.

func (*MockPeerListerMockRecorder) Members added in v1.2.14

func (mr *MockPeerListerMockRecorder) Members(service interface{}) *gomock.Call

Members indicates an expected call of Members.

func (*MockPeerListerMockRecorder) Subscribe added in v1.2.14

func (mr *MockPeerListerMockRecorder) Subscribe(service, name, notifyChannel interface{}) *gomock.Call

Subscribe indicates an expected call of Subscribe.

func (*MockPeerListerMockRecorder) Unsubscribe added in v1.2.14

func (mr *MockPeerListerMockRecorder) Unsubscribe(service, name interface{}) *gomock.Call

Unsubscribe indicates an expected call of Unsubscribe.

type Outbounds added in v1.2.14

type Outbounds struct {
	yarpc.Outbounds
	// contains filtered or unexported fields
}

func (*Outbounds) UpdatePeers added in v1.2.14

func (o *Outbounds) UpdatePeers(serviceName string, peers []membership.HostInfo)

type OutboundsBuilder added in v0.24.0

type OutboundsBuilder interface {
	// Build creates yarpc outbounds given transport instances for either gRPC and TChannel based on the configuration
	Build(*grpc.Transport, *tchannel.Transport) (*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 NewDirectOutboundBuilder added in v1.2.14

func NewDirectOutboundBuilder(serviceName string, grpcEnabled bool, tlsConfig *tls.Config, pcf PeerChooserFactory, enableConnRetainMode dynamicconfig.BoolPropertyFn) 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, logger log.Logger, metricsCl metrics.Client) (Params, error)

NewParams creates parameters for rpc.Factory from the given config

type PeerChooser added in v1.2.14

type PeerChooser interface {
	peer.Chooser

	// UpdatePeers updates the list of peers if needed.
	UpdatePeers(serviceName string, members []membership.HostInfo)
}

type PeerChooserFactory added in v0.24.0

type PeerChooserFactory interface {
	CreatePeerChooser(transport peer.Transport, opts PeerChooserOptions) (PeerChooser, error)
}

func NewDNSPeerChooserFactory added in v0.24.0

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

func NewDirectPeerChooserFactory added in v1.2.14

func NewDirectPeerChooserFactory(serviceName string, logger log.Logger, metricsCl metrics.Client) PeerChooserFactory

type PeerChooserOptions added in v1.2.14

type PeerChooserOptions struct {
	// Address is the target dns address. Used by dns peer chooser.
	Address string

	// ServiceName is the name of service. Used by direct peer chooser.
	ServiceName string

	// EnableConnectionRetainingDirectChooser is used by direct peer chooser.
	// If false, yarpc's own default direct peer chooser will be used which doesn't retain connections.
	// If true, cadence's own direct peer chooser will be used which retains connections.
	EnableConnectionRetainingDirectChooser dynamicconfig.BoolPropertyFn
}

type PeerLister added in v1.2.14

type PeerLister interface {
	Subscribe(service, name string, notifyChannel chan<- *membership.ChangedEvent) error
	Unsubscribe(service, name string) error
	Members(service string) ([]membership.HostInfo, error)
}

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