rpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultServiceConfig is a default gRPC connection service config which enables DNS round robin between IPs.
	// To use DNS resolver, a "dns:///" prefix should be applied to the hostPort.
	// https://github.com/grpc/grpc/blob/master/doc/naming.md
	DefaultServiceConfig = `{"loadBalancingConfig": [{"round_robin":{}}]}`

	// MaxBackoffDelay is a maximum interval between reconnect attempts.
	MaxBackoffDelay = 10 * time.Second

	// MaxHTTPAPIRequestBytes is the maximum number of bytes an HTTP API request
	// can have. This is currently set to the max gRPC request size.
	MaxHTTPAPIRequestBytes = 4 * 1024 * 1024

	// MaxNexusAPIRequestBodyBytes is the maximum number of bytes a Nexus HTTP API request can have. Because the body is
	// read into a Payload object, this is currently set to the max Payload size. Content headers are transformed to
	// Payload metadata and contribute to the Payload size as well. A separate limit is enforced on top of this.
	MaxNexusAPIRequestBodyBytes = 2 * 1024 * 1024
)

Variables

This section is empty.

Functions

func CopyContextValues

func CopyContextValues(dst context.Context, src context.Context) context.Context

CopyContextValues copies values in source Context to destination Context.

func Dial

func Dial(
	hostName string,
	tlsConfig *tls.Config,
	logger log.Logger,
	metricsHandler metrics.Handler,
	opts ...grpc.DialOption,
) (*grpc.ClientConn, error)

Dial creates a client connection to the given target with default options. The hostName syntax is defined in https://github.com/grpc/grpc/blob/master/doc/naming.md. dns resolver is used by default

func NewContextFromParentWithTimeoutAndVersionHeaders

func NewContextFromParentWithTimeoutAndVersionHeaders(parentCtx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

NewContextFromParentWithTimeoutAndVersionHeaders creates context from parent context with timeout and version headers.

func NewContextWithTimeoutAndVersionHeaders

func NewContextWithTimeoutAndVersionHeaders(timeout time.Duration) (context.Context, context.CancelFunc)

NewContextWithTimeoutAndVersionHeaders creates context with timeout and version headers.

func ResetContextTimeout

func ResetContextTimeout(ctx context.Context, newTimeout time.Duration) (context.Context, context.CancelFunc)

ResetContextTimeout creates new context with specified timeout and copies values from source Context.

Types

type MultiStatsHandler

type MultiStatsHandler []stats.Handler

MultiStatsHandler forwards stats to multiple stats.Handlers.

func (MultiStatsHandler) HandleConn

func (m MultiStatsHandler) HandleConn(ctx context.Context, cs stats.ConnStats)

func (MultiStatsHandler) HandleRPC

func (m MultiStatsHandler) HandleRPC(ctx context.Context, rs stats.RPCStats)

func (MultiStatsHandler) TagConn

func (MultiStatsHandler) TagRPC

type RPCFactory

type RPCFactory struct {

	// TODO: Remove these flags once the keepalive settings are rolled out
	EnableInternodeServerKeepalive bool
	EnableInternodeClientKeepalive bool
	// contains filtered or unexported fields
}

RPCFactory is an implementation of common.RPCFactory interface

func NewFactory

func NewFactory(
	cfg *config.Config,
	sName primitives.ServiceName,
	logger log.Logger,
	metricsHandler metrics.Handler,
	tlsProvider encryption.TLSConfigProvider,
	frontendURL string,
	frontendHTTPURL string,
	frontendHTTPPort int,
	frontendTLSConfig *tls.Config,
	commonDialOptions []grpc.DialOption,
	perServiceDialOptions map[primitives.ServiceName][]grpc.DialOption,
	monitor membership.Monitor,
) *RPCFactory

NewFactory builds a new RPCFactory conforming to the underlying configuration

func (*RPCFactory) CreateHistoryGRPCConnection

func (d *RPCFactory) CreateHistoryGRPCConnection(rpcAddress string) grpc.ClientConnInterface

func (*RPCFactory) CreateLocalFrontendGRPCConnection

func (d *RPCFactory) CreateLocalFrontendGRPCConnection() grpc.ClientConnInterface

CreateLocalFrontendGRPCConnection creates connection for internal frontend calls

func (*RPCFactory) CreateLocalFrontendHTTPClient

func (d *RPCFactory) CreateLocalFrontendHTTPClient() (*common.FrontendHTTPClient, error)

CreateLocalFrontendHTTPClient gets or creates a cached frontend client.

func (*RPCFactory) CreateMatchingGRPCConnection

func (d *RPCFactory) CreateMatchingGRPCConnection(rpcAddress string) grpc.ClientConnInterface

func (*RPCFactory) CreateRemoteFrontendGRPCConnection

func (d *RPCFactory) CreateRemoteFrontendGRPCConnection(rpcAddress string) grpc.ClientConnInterface

CreateRemoteFrontendGRPCConnection creates connection for gRPC calls

func (*RPCFactory) GetFrontendClientTlsConfig

func (d *RPCFactory) GetFrontendClientTlsConfig() (*tls.Config, error)

func (*RPCFactory) GetFrontendGRPCServerOptions

func (d *RPCFactory) GetFrontendGRPCServerOptions() ([]grpc.ServerOption, error)

func (*RPCFactory) GetGRPCListener

func (d *RPCFactory) GetGRPCListener() net.Listener

GetGRPCListener returns cached dispatcher for gRPC inbound or creates one

func (*RPCFactory) GetInternodeClientTlsConfig

func (d *RPCFactory) GetInternodeClientTlsConfig() (*tls.Config, error)

func (*RPCFactory) GetInternodeGRPCServerOptions

func (d *RPCFactory) GetInternodeGRPCServerOptions() ([]grpc.ServerOption, error)

func (*RPCFactory) GetRemoteClusterClientConfig

func (d *RPCFactory) GetRemoteClusterClientConfig(hostname string) (*tls.Config, error)

func (*RPCFactory) GetTLSConfigProvider

func (d *RPCFactory) GetTLSConfigProvider() encryption.TLSConfigProvider

type RequestIssues

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

RequestIssues is a collection of request validation issues for an RPC. The zero value is valid to use.

func (*RequestIssues) Append

func (ri *RequestIssues) Append(issue string)

Append an issue to the set.

func (*RequestIssues) Appendf

func (ri *RequestIssues) Appendf(format string, args ...any)

Appendf appends a formatted issue to the set.

func (*RequestIssues) GetError

func (ri *RequestIssues) GetError() error

GetError returns a gRPC INVALID_ARGUMENT error representing the issues in the set or nil if there are no issues.

Directories

Path Synopsis
Package interceptor is a generated GoMock package.
Package interceptor is a generated GoMock package.
Package zaptransport implements a gRPC-compatible server and client backed by luxfi/zap zero-copy binary RPC.
Package zaptransport implements a gRPC-compatible server and client backed by luxfi/zap zero-copy binary RPC.

Jump to

Keyboard shortcuts

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