server

package
v0.0.0-...-917d9ad Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnConfig

type ConnConfig struct {
	network.Config

	Kleepalive int32
	Pool       RpcPool
}

func Configure

func Configure(options ...ConnConfigOption) *ConnConfig

type ConnConfigOption

type ConnConfigOption func(config *ConnConfig)

ConnConfigOption 是一个配置rpc connector 的函数

func WithKleepalive

func WithKleepalive(kleepalive int32) ConnConfigOption

WithKleepalive 设置心跳时间

func WithPool

func WithPool(f RpcPool) ConnConfigOption

type RpcClient

type RpcClient interface {
	ClientID() *network.ClientID
	Register(key interface{}, f func(*RpcClientContext) (protoreflect.ProtoMessage, error))
	Accept(ctx network.Context)
	Ping(ctx network.Context)
	Recvice(ctx network.Context)
	Closed(ctx network.Context)
	Destory()
	// contains filtered or unexported methods
}

func NewRpcClientConn

func NewRpcClientConn(s *RpcServer) RpcClient

type RpcClientConn

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

func (*RpcClientConn) Accept

func (rcc *RpcClientConn) Accept(ctx network.Context)

func (*RpcClientConn) ClientID

func (rcc *RpcClientConn) ClientID() *network.ClientID

func (*RpcClientConn) Closed

func (rcc *RpcClientConn) Closed(ctx network.Context)

func (*RpcClientConn) Destory

func (rcc *RpcClientConn) Destory()

func (*RpcClientConn) Ping

func (rcc *RpcClientConn) Ping(ctx network.Context)

func (*RpcClientConn) Recvice

func (rcc *RpcClientConn) Recvice(ctx network.Context)

func (*RpcClientConn) Register

func (rcc *RpcClientConn) Register(key interface{}, f func(*RpcClientContext) (protoreflect.ProtoMessage, error))

type RpcClientContext

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

func (*RpcClientContext) Background

func (rcc *RpcClientContext) Background() context.Context

func (*RpcClientContext) Context

func (rcc *RpcClientContext) Context() network.Context

func (*RpcClientContext) Message

func (rcc *RpcClientContext) Message() interface{}

func (*RpcClientContext) SequenceID

func (rcc *RpcClientContext) SequenceID() int32

type RpcPool

type RpcPool interface {
	Get() RpcClient
	Put(s RpcClient)
}

func NewDefaultRpcPool

func NewDefaultRpcPool(s *RpcServer) RpcPool

type RpcServer

type RpcServer struct {
	*network.NetworkSystem
	// contains filtered or unexported fields
}

func New

func New(options ...ConnConfigOption) *RpcServer

func (*RpcServer) GetClient

func (s *RpcServer) GetClient(cid *network.ClientID) RpcClient

func (*RpcServer) Open

func (s *RpcServer) Open(addr string) error

func (*RpcServer) Register

func (s *RpcServer) Register(cid *network.ClientID, rc RpcClient)

func (*RpcServer) ReleaseClient

func (s *RpcServer) ReleaseClient(client RpcClient)

func (*RpcServer) Shutdown

func (s *RpcServer) Shutdown()

func (*RpcServer) UnRegister

func (s *RpcServer) UnRegister(cid *network.ClientID)

func (*RpcServer) WithPool

func (s *RpcServer) WithPool(pool RpcPool)

Jump to

Keyboard shortcuts

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