common

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const INVALIED_STUB_ID uint32 = 0

Variables

View Source
var (
	DefaultTimeOut       uint32 = 2000 // to second
	DefaultCallCache     uint32 = 128
	DefaultServiceWorker uint32 = 1
	DefaultServiceCache  uint32 = 8
	MaxRetryTime         int32  = 5 // max retry time TODO read from config
)
View Source
var (
	TransportClose  = &RpcError{TRANSPORT_CLOSED, "Transport has been closed"}
	ProxyInvalid    = &RpcError{PROXY_NOT_EXIST, "Proxy Is Invalid"}
	StubCallInvalid = &RpcError{STUBCALL_INVALID, "stubcall invalid"}
	ServicePanic    = &RpcError{SERVICE_PANIC, "service exec panic"}
	RequestInvalid  = &RpcError{errCode: COMM_ERR, errStr: "invalid request messsage!"}
	ProtocolError   = &RpcError{errCode: COMM_ERR, errStr: "rpc protocol message buffer error !"}
)

Functions

func GetConnID

func GetConnID() uint64

获取ConnID

func IsNetEofError

func IsNetEofError(err error) bool

func IsNetOpError

func IsNetOpError(err error) bool

func IsNoDataError

func IsNoDataError(err error) bool

Types

type RpcError added in v0.3.0

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

func NewMethodExecError added in v0.3.0

func NewMethodExecError(service, method string) *RpcError

func NewProxyDisconnected added in v0.3.0

func NewProxyDisconnected(uuid uint64, id uint32, name string) *RpcError

func NewProxyNotExit added in v0.3.0

func NewProxyNotExit(proxyid uint32) *RpcError

func NewProxyNotFound added in v0.3.0

func NewProxyNotFound(callid uint32) *RpcError

func NewRpcError added in v0.3.0

func NewRpcError(code RpcErrorCode, format string, args ...interface{}) *RpcError

func NewServiceNotExist added in v0.3.0

func NewServiceNotExist(uuid uint64) *RpcError

func (*RpcError) Code added in v0.3.0

func (re *RpcError) Code() RpcErrorCode

func (*RpcError) Error added in v0.3.0

func (re *RpcError) Error() string

type RpcErrorCode added in v0.3.0

type RpcErrorCode uint32
const (
	COMM_ERR RpcErrorCode = iota + 1
	TRANSPORT_CLOSED
	PROXY_NOT_EXIST
	PROXY_DISCONNECTED
	PROXY_TIMEOUT
	PROXY_CALL_NO_FOUND
	STUBCALL_INVALID
	SERVICE_SHUTDOWN
	SERVICE_NOT_EXIST
	SERIVCE_HAS_EXIST
	METHOD_EXECERROR
	SERVICE_PANIC
	SERVICE_NOT_FOUND
	FUNCTION_NOT_FOUND
)

Jump to

Keyboard shortcuts

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