rpcinfo

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 592

Documentation

Index

Constants

View Source
const (
	ConnResetTag     = "crrst"
	RetryTag         = "retry"
	RetryLastCostTag = "last_cost"
	RetryPrevInstTag = "prev_inst"
	ShmIPCTag        = "shmipc"
	RemoteClosedTag  = "remote_closed"
)

Tag names in EndpointInfo. Notice: These keys just be used for framework.

View Source
const (
	// connection full url
	HTTPURL = "http_url"
	// specify host header
	HTTPHost = "http_host"
	// http header for remote message tag
	HTTPHeader = "http_header"
)

client HTTP

View Source
const (
	BitRPCTimeout = 1 << iota
	BitConnectTimeout
	BitReadWriteTimeout
	BitIOBufferSize
)

Mask bits.

Variables

This section is empty.

Functions

func NewCtxWithRPCInfo

func NewCtxWithRPCInfo(ctx context.Context, ri RPCInfo) context.Context

NewCtxWithRPCInfo creates a new context with the RPCInfo given.

func PutRPCInfo

func PutRPCInfo(ri RPCInfo)

PutRPCInfo recycles the RPCInfo. This function is for internal use only.

Types

type EndpointBasicInfo

type EndpointBasicInfo struct {
	ServiceName string
	Method      string
	Tags        map[string]string
}

EndpointBasicInfo should be immutable after created.

type EndpointInfo

type EndpointInfo interface {
	ServiceName() string
	Method() string
	Address() net.Addr
	Tag(key string) (value string, exist bool)
	DefaultTag(key, def string) string
}

EndpointInfo contains info for endpoint.

func EmptyEndpointInfo

func EmptyEndpointInfo() EndpointInfo

EmptyEndpointInfo creates an empty EndpointInfo.

func FromBasicInfo

func FromBasicInfo(bi *EndpointBasicInfo) EndpointInfo

FromBasicInfo converts an EndpointBasicInfo into EndpointInfo.

func NewEndpointInfo

func NewEndpointInfo(serviceName, method string, address net.Addr, tags map[string]string) EndpointInfo

NewEndpointInfo creates an immutable EndpointInfo with the given information.

type Event

type Event interface {
	Event() stats.Event
	Status() stats.Status
	Info() string
	Time() time.Time
	IsNil() bool
}

Event is the abstraction of an event happened at a specific time.

type Invocation

type Invocation interface {
	PackageName() string
	ServiceName() string
	MethodName() string
	SeqID() int32
}

Invocation contains specific information about the call.

func NewInvocation

func NewInvocation(service string, method string, pkgOpt ...string) Invocation

NewInvocation creates a new Invocation with the given service, method and optional package.

func NewServerInvocation

func NewServerInvocation() Invocation

NewServerInvocation to get Invocation for new request in server side

type InvocationSetter

type InvocationSetter interface {
	SetPackageName(name string)
	SetServiceName(name string)
	SetMethodName(name string)
	SetSeqID(seqID int32)
}

InvocationSetter is used to set information about an RPC.

type MutableEndpointInfo

type MutableEndpointInfo interface {
	SetServiceName(service string) error
	SetMethod(method string) error
	SetAddress(addr net.Addr) error
	SetTag(key string, value string) error
	ImmutableView() EndpointInfo
}

MutableEndpointInfo is used to change the information in the EndpointInfo.

func AsMutableEndpointInfo

func AsMutableEndpointInfo(ei EndpointInfo) MutableEndpointInfo

AsMutableEndpointInfo converts an EnpointInfo into a MutableEndpointInfo. Returns nil if impossible.

func NewMutableEndpointInfo

func NewMutableEndpointInfo(serviceName, method string, address net.Addr, tags map[string]string) MutableEndpointInfo

NewMutableEndpointInfo creates a new MutableEndpointInfo with the given information.

type MutableRPCConfig

type MutableRPCConfig interface {
	SetRPCTimeout(to time.Duration) error
	IsRPCTimeoutLocked() bool
	SetConnectTimeout(to time.Duration) error
	IsConnectTimeoutLocked() bool
	SetReadWriteTimeout(to time.Duration) error
	IsReadWriteTimeoutLocked() bool
	SetIOBufferSize(sz int) error
	SetTransportProtocol(tp transport.Protocol) error
	LockConfig(bits int)
	Clone() MutableRPCConfig
	ImmutableView() RPCConfig
}

MutableRPCConfig is used to change the information in the RPCConfig.

func AsMutableRPCConfig

func AsMutableRPCConfig(r RPCConfig) MutableRPCConfig

AsMutableRPCConfig .

type MutableRPCStats

type MutableRPCStats interface {
	SetSendSize(size uint64)
	SetRecvSize(size uint64)
	SetError(err error)
	SetPanicked(x interface{})
	SetLevel(level stats.Level)
	Reset()
	ImmutableView() RPCStats
}

MutableRPCStats is used to change the information in the RPCStats.

func AsMutableRPCStats

func AsMutableRPCStats(r RPCStats) MutableRPCStats

AsMutableRPCStats converts an rpcStats into a MutableRPCStats. Returns nil if impossible.

type RPCConfig

type RPCConfig interface {
	RPCTimeout() time.Duration
	ConnectTimeout() time.Duration
	ReadWriteTimeout() time.Duration
	IOBufferSize() int
	TransportProtocol() transport.Protocol
}

RPCConfig contains configuration for RPC.

func NewRPCConfig

func NewRPCConfig() RPCConfig

NewRPCConfig creates a default RPCConfig.

type RPCInfo

type RPCInfo interface {
	From() EndpointInfo
	To() EndpointInfo
	Invocation() Invocation
	Config() RPCConfig
	Stats() RPCStats
}

RPCInfo is the core abstraction of information about an RPC in Kitex.

func GetRPCInfo

func GetRPCInfo(ctx context.Context) RPCInfo

GetRPCInfo gets RPCInfo from ctx. Returns nil if not found.

func NewRPCInfo

func NewRPCInfo(from, to EndpointInfo, ink Invocation, config RPCConfig, stats RPCStats) RPCInfo

NewRPCInfo creates a new RPCInfo using the given information.

type RPCStats

type RPCStats interface {
	Record(ctx context.Context, event stats.Event, status stats.Status, info string)

	SendSize() uint64
	RecvSize() uint64
	Error() error
	Panicked() (bool, interface{})
	GetEvent(event stats.Event) Event

	Level() stats.Level
}

RPCStats is used to collect statistics about the RPC.

func NewRPCStats

func NewRPCStats() RPCStats

NewRPCStats creates a new RPCStats.

type Taggable

type Taggable interface {
	SetTag(key string, value string) error
}

Taggable is a type that supports setting tag.

func AsTaggable

func AsTaggable(i interface{}) Taggable

AsTaggable converts an object into a Taggable. Returns nil if impossible.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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