Documentation ¶
Index ¶
- func EnablePoolClientInfo(enable bool)
- func EnablePoolMessageEnvelope(enable bool)
- func FreeCtxWithServantClientInfo(ctx context.Context) context.Context
- func NewCtxWithServantClientInfo(ctx context.Context, si *ServantClientInfo) context.Context
- func PoolEnabledClientInfo() bool
- func PoolEnabledMessageEnvelope() bool
- func UnwrapEnvelopeMessage(message interface{}) interface{}
- func UnwrapEnvelopeSender(message interface{}) (*network.ClientID, bool)
- func UnwrapEnvelopeSequenceId(message interface{}) (int32, bool)
- type MessageEnvelope
- type Servant
- type ServantClientActor
- type ServantClientConn
- type ServantClientInfo
- type ServantConfig
- type ServantConfigOption
- func WithKleepalive(kleepalive int32) ServantConfigOption
- func WithLAddr(laddr string) ServantConfigOption
- func WithMetricsProvider(provider metric.MeterProvider) ServantConfigOption
- func WithName(name string) ServantConfigOption
- func WithProducerActor(f func(*ServantClientConn) ServantClientActor) ServantConfigOption
- func WithRoute(router *router.RouterConfig) ServantConfigOption
- func WithVAddr(vaddr string) ServantConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnablePoolClientInfo ¶
func EnablePoolClientInfo(enable bool)
func EnablePoolMessageEnvelope ¶
func EnablePoolMessageEnvelope(enable bool)
func NewCtxWithServantClientInfo ¶
func NewCtxWithServantClientInfo(ctx context.Context, si *ServantClientInfo) context.Context
func PoolEnabledClientInfo ¶
func PoolEnabledClientInfo() bool
PoolEnabled returns true if pool is enabled.
func PoolEnabledMessageEnvelope ¶
func PoolEnabledMessageEnvelope() bool
func UnwrapEnvelopeMessage ¶
func UnwrapEnvelopeMessage(message interface{}) interface{}
func UnwrapEnvelopeSender ¶
Types ¶
type MessageEnvelope ¶
type MessageEnvelope struct {
// contains filtered or unexported fields
}
func NewMessageEnvelopePool ¶
func NewMessageEnvelopePool(seqId int32, clientId *network.ClientID, message interface{}) *MessageEnvelope
func (*MessageEnvelope) Recycle ¶
func (me *MessageEnvelope) Recycle()
type Servant ¶
type Servant struct { System *network.NetworkSystem Config *ServantConfig // contains filtered or unexported fields }
func New ¶
func New(options ...ServantConfigOption) *Servant
func (*Servant) FindRouter ¶
FindRouter 查询路由
type ServantClientActor ¶
type ServantClientConn ¶
type ServantClientConn struct { Servant *Servant // contains filtered or unexported fields }
func (*ServantClientConn) Accept ¶
func (c *ServantClientConn) Accept(ctx network.Context)
func (*ServantClientConn) Closed ¶
func (c *ServantClientConn) Closed(ctx network.Context)
func (*ServantClientConn) Ping ¶
func (c *ServantClientConn) Ping(ctx network.Context)
Ping 客户端主动请求, 这里不处理
func (*ServantClientConn) Recvice ¶
func (c *ServantClientConn) Recvice(ctx network.Context)
Recvice 接收到的数据
func (*ServantClientConn) Register ¶
func (c *ServantClientConn) Register(key, evt interface{})
Register 注册方法映射
type ServantClientInfo ¶
type ServantClientInfo struct {
// contains filtered or unexported fields
}
func GetServantClientInfo ¶
func GetServantClientInfo(ctx context.Context) *ServantClientInfo
func NewClientInfo ¶
func NewClientInfo(ctx network.Context, message interface{}) *ServantClientInfo
func (*ServantClientInfo) Message ¶
func (s *ServantClientInfo) Message() interface{}
func (*ServantClientInfo) Recycle ¶
func (s *ServantClientInfo) Recycle()
func (*ServantClientInfo) Sender ¶
func (s *ServantClientInfo) Sender() *network.ClientID
func (*ServantClientInfo) SeqId ¶
func (s *ServantClientInfo) SeqId() int32
type ServantConfig ¶
type ServantConfig struct { MetricsProvider metric.MeterProvider Producer func(*ServantClientConn) ServantClientActor Name string LAddr string VAddr string Kleepalive int32 Router *router.RouterConfig }
type ServantConfigOption ¶
type ServantConfigOption func(config *ServantConfig)
func WithKleepalive ¶
func WithKleepalive(kleepalive int32) ServantConfigOption
WithKleepalive 设置心跳时间
func WithMetricsProvider ¶
func WithMetricsProvider(provider metric.MeterProvider) ServantConfigOption
WithMetricsProvider ...
func WithProducerActor ¶
func WithProducerActor(f func(*ServantClientConn) ServantClientActor) ServantConfigOption
WithProducerActor actor 创建器
Click to show internal directories.
Click to hide internal directories.