Documentation ¶
Index ¶
- Constants
- func NewCtxWithRPCInfo(ctx context.Context, ri RPCInfo) context.Context
- func PutRPCInfo(ri RPCInfo)
- type EndpointBasicInfo
- type EndpointInfo
- type Event
- type Invocation
- type InvocationSetter
- type MutableEndpointInfo
- type MutableRPCConfig
- type MutableRPCStats
- type RPCConfig
- type RPCInfo
- type RPCStats
- type Taggable
Constants ¶
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.
const ( // connection full url HTTPURL = "http_url" // specify host header HTTPHost = "http_host" // http header for remote message tag HTTPHeader = "http_header" )
client HTTP
const ( BitRPCTimeout = 1 << iota BitConnectTimeout BitReadWriteTimeout BitIOBufferSize )
Mask bits.
Variables ¶
This section is empty.
Functions ¶
func NewCtxWithRPCInfo ¶
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 ¶
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.
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 ¶
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.