trans

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMethodInfo

func GetMethodInfo(ri rpcinfo.RPCInfo, svcInfo *serviceinfo.ServiceInfo) (serviceinfo.MethodInfo, error)

GetMethodInfo is used to get method info from serviceinfo.MethodInfo by method name/

func GetReadTimeout

func GetReadTimeout(cfg rpcinfo.RPCConfig) time.Duration

GetReadTimeout is to make the read timeout logger, it is better for proxy case to receive error resp.

func NewDefaultCliTransHandler

func NewDefaultCliTransHandler(opt *remote.ClientOption, ext Extension) (remote.ClientTransHandler, error)

NewDefaultCliTransHandler to provide default impl of cliTransHandler, it can be reused in netpoll, shm-ipc, framework-sdk extensions

func NewDefaultSvrTransHandler

func NewDefaultSvrTransHandler(opt *remote.ServerOption, ext Extension) (remote.ServerTransHandler, error)

NewDefaultSvrTransHandler to provide default impl of svrTransHandler, it can be reused in netpoll, shm-ipc, framework-sdk extensions

Types

type Extension

type Extension interface {
	SetReadTimeout(ctx context.Context, conn net.Conn, cfg rpcinfo.RPCConfig, role remote.RPCRole)
	NewWriteByteBuffer(ctx context.Context, conn net.Conn, msg remote.Message) remote.ByteBuffer
	NewReadByteBuffer(ctx context.Context, conn net.Conn, msg remote.Message) remote.ByteBuffer
	ReleaseBuffer(remote.ByteBuffer, error) error
	IsTimeoutErr(error) bool
	// IsRemoteClosedErr is to check if the error caused by connection closed when output log or report metric
	IsRemoteClosedErr(error) bool
}

Extension is the interface that trans extensions need to implement, it will make the extension of trans more easily. Normally if we want to extend transport layer we need to implement the trans interfaces which are defined in trans_handler.go. In fact most code logic is similar in same mode, so the Extension interface is the the differentiated part that need to be implemented separately. The default common trans implement is in default_client_handler.go and default_server_handler.go.

Directories

Path Synopsis
Package detection protocol detection
Package detection protocol detection
Package invoke .
Package invoke .
Package netpoll contains server and client implementation for netpoll.
Package netpoll contains server and client implementation for netpoll.
Package nphttp2 transport powered by netpoll
Package nphttp2 transport powered by netpoll
codes
Package codes defines the canonical error codes used by gRPC.
Package codes defines the canonical error codes used by gRPC.
grpc
Package grpc defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
Package grpc defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
metadata
Package metadata define the structure of the metadata supported by gRPC library.
Package metadata define the structure of the metadata supported by gRPC library.
status
Package status implements errors returned by gRPC.
Package status implements errors returned by gRPC.

Jump to

Keyboard shortcuts

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