rpcli

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: LGPL-2.1 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEntityNotFound               = errors.New("rpc: entity not found")                // 找不到实体
	ErrMethodNotFound               = errors.New("rpc: method not found")                // 找不到方法
	ErrMethodParameterCountMismatch = errors.New("rpc: method parameter count mismatch") // 方法参数数量不匹配
	ErrMethodParameterTypeMismatch  = errors.New("rpc: method parameter type mismatch")  // 方法参数类型不匹配
)
View Source
var (
	Main = uid.Nil // 主过程
)

Functions

This section is empty.

Types

type IProcedure added in v0.1.37

type IProcedure interface {

	// GetCli 获取RPC客户端
	GetCli() *RPCli
	// GetId 获取实体Id
	GetId() uid.Id
	// GetReflected 获取反射值
	GetReflected() reflect.Value
	// RPC RPC调用
	RPC(service, comp, method string, args ...any) async.AsyncRet
	// OneWayRPC 单向RPC调用
	OneWayRPC(service, comp, method string, args ...any) error
	// contains filtered or unexported methods
}

IProcedure 过程接口

type Procedure added in v0.1.37

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

Procedure 过程

func (*Procedure) GetCli added in v0.1.37

func (p *Procedure) GetCli() *RPCli

GetCli 获取RPC客户端

func (*Procedure) GetId added in v0.1.37

func (p *Procedure) GetId() uid.Id

GetId 获取实体Id

func (*Procedure) GetReflected added in v0.1.37

func (p *Procedure) GetReflected() reflect.Value

GetReflected 获取反射值

func (*Procedure) OneWayRPC added in v0.1.37

func (p *Procedure) OneWayRPC(service, comp, method string, args ...any) error

OneWayRPC 单向RPC调用

func (*Procedure) RPC added in v0.1.37

func (p *Procedure) RPC(service, comp, method string, args ...any) async.AsyncRet

RPC RPC调用

type RPCli

type RPCli struct {
	*cli.Client
	// contains filtered or unexported fields
}

RPCli RCP客户端

func (*RPCli) AddProcedure added in v0.1.37

func (c *RPCli) AddProcedure(id uid.Id, proc any) error

AddProcedure 添加过程

func (*RPCli) GetProcedure added in v0.1.37

func (c *RPCli) GetProcedure(id uid.Id) (IProcedure, bool)

GetProcedure 查询过程

func (*RPCli) OneWayRPC

func (c *RPCli) OneWayRPC(service, comp, method string, args ...any) error

OneWayRPC 单向RPC调用

func (*RPCli) OneWayRPCToEntity

func (c *RPCli) OneWayRPCToEntity(entityId uid.Id, service, comp, method string, args ...any) error

OneWayRPCToEntity 实体单向RPC调用

func (*RPCli) RPC

func (c *RPCli) RPC(service, comp, method string, args ...any) async.AsyncRet

RPC RPC调用

func (*RPCli) RPCToEntity

func (c *RPCli) RPCToEntity(entityId uid.Id, service, comp, method string, args ...any) async.AsyncRet

RPCToEntity 实体RPC调用

func (*RPCli) RemoveProcedure added in v0.1.37

func (c *RPCli) RemoveProcedure(id uid.Id) error

RemoveProcedure 删除过程

type RPCliCreator

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

RPCliCreator RPC客户端构建器

func CreateRPCli

func CreateRPCli() RPCliCreator

CreateRPCli 创建RPC客户端

func (RPCliCreator) AuthExtensions

func (ctor RPCliCreator) AuthExtensions(extensions []byte) RPCliCreator

func (RPCliCreator) AuthToken

func (ctor RPCliCreator) AuthToken(token string) RPCliCreator

func (RPCliCreator) AuthUserId

func (ctor RPCliCreator) AuthUserId(userId string) RPCliCreator

func (RPCliCreator) Connect

func (ctor RPCliCreator) Connect(ctx context.Context, endpoint string) (*RPCli, error)

func (RPCliCreator) FutureTimeout

func (ctor RPCliCreator) FutureTimeout(d time.Duration) RPCliCreator

func (RPCliCreator) GAPDecoderMsgCreator

func (ctor RPCliCreator) GAPDecoderMsgCreator(mc gap.IMsgCreator) RPCliCreator

func (RPCliCreator) GTPAutoReconnect

func (ctor RPCliCreator) GTPAutoReconnect(b bool) RPCliCreator

func (RPCliCreator) GTPAutoReconnectInterval

func (ctor RPCliCreator) GTPAutoReconnectInterval(dur time.Duration) RPCliCreator

func (RPCliCreator) GTPAutoReconnectRetryTimes

func (ctor RPCliCreator) GTPAutoReconnectRetryTimes(times int) RPCliCreator

func (RPCliCreator) GTPCompressedSize

func (ctor RPCliCreator) GTPCompressedSize(size int) RPCliCreator

func (RPCliCreator) GTPCompression

func (ctor RPCliCreator) GTPCompression(c gtp.Compression) RPCliCreator

func (RPCliCreator) GTPDecoderMsgCreator

func (ctor RPCliCreator) GTPDecoderMsgCreator(mc gtp.IMsgCreator) RPCliCreator

func (RPCliCreator) GTPEncCipherSuite

func (ctor RPCliCreator) GTPEncCipherSuite(cs gtp.CipherSuite) RPCliCreator

func (RPCliCreator) GTPEncSignatureAlgorithm

func (ctor RPCliCreator) GTPEncSignatureAlgorithm(sa gtp.SignatureAlgorithm) RPCliCreator

func (RPCliCreator) GTPEncSignaturePrivateKey

func (ctor RPCliCreator) GTPEncSignaturePrivateKey(priv crypto.PrivateKey) RPCliCreator

func (RPCliCreator) GTPEncVerifyServerSignature

func (ctor RPCliCreator) GTPEncVerifyServerSignature(b bool) RPCliCreator

func (RPCliCreator) GTPEncVerifySignaturePublicKey

func (ctor RPCliCreator) GTPEncVerifySignaturePublicKey(pub crypto.PublicKey) RPCliCreator

func (RPCliCreator) GTPInactiveTimeout

func (ctor RPCliCreator) GTPInactiveTimeout(d time.Duration) RPCliCreator

func (RPCliCreator) GTPRecvDataChanSize

func (ctor RPCliCreator) GTPRecvDataChanSize(size int, recyclable bool) RPCliCreator

func (RPCliCreator) GTPRecvDataHandler

func (ctor RPCliCreator) GTPRecvDataHandler(handler cli.RecvDataHandler) RPCliCreator

func (RPCliCreator) GTPRecvEventChanSize

func (ctor RPCliCreator) GTPRecvEventChanSize(size int) RPCliCreator

func (RPCliCreator) GTPRecvEventHandler

func (ctor RPCliCreator) GTPRecvEventHandler(handler cli.RecvEventHandler) RPCliCreator

func (RPCliCreator) GTPSendDataChanSize

func (ctor RPCliCreator) GTPSendDataChanSize(size int) RPCliCreator

func (RPCliCreator) GTPSendEventChanSize

func (ctor RPCliCreator) GTPSendEventChanSize(size int) RPCliCreator

func (RPCliCreator) IOBufferCap

func (ctor RPCliCreator) IOBufferCap(cap int) RPCliCreator

func (RPCliCreator) IORetryTimes

func (ctor RPCliCreator) IORetryTimes(times int) RPCliCreator

func (RPCliCreator) IOTimeout

func (ctor RPCliCreator) IOTimeout(d time.Duration) RPCliCreator

func (RPCliCreator) MainProcedure added in v0.1.37

func (ctor RPCliCreator) MainProcedure(proc any) RPCliCreator

func (RPCliCreator) NetProtocol added in v0.1.40

func (ctor RPCliCreator) NetProtocol(p cli.NetProtocol) RPCliCreator

func (RPCliCreator) TCPLinger

func (ctor RPCliCreator) TCPLinger(sec int) RPCliCreator

func (RPCliCreator) TCPNoDelay

func (ctor RPCliCreator) TCPNoDelay(b bool) RPCliCreator

func (RPCliCreator) TCPQuickAck

func (ctor RPCliCreator) TCPQuickAck(b bool) RPCliCreator

func (RPCliCreator) TCPRecvBuf

func (ctor RPCliCreator) TCPRecvBuf(size int) RPCliCreator

func (RPCliCreator) TCPSendBuf

func (ctor RPCliCreator) TCPSendBuf(size int) RPCliCreator

func (RPCliCreator) TLSConfig

func (ctor RPCliCreator) TLSConfig(tlsConfig tls.Config) RPCliCreator

func (RPCliCreator) WebSocketOrigin added in v0.1.40

func (ctor RPCliCreator) WebSocketOrigin(origin string) RPCliCreator

func (RPCliCreator) ZapLogger

func (ctor RPCliCreator) ZapLogger(logger *zap.Logger) RPCliCreator

Jump to

Keyboard shortcuts

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