connection

package
v0.0.0-...-a224364 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(bootstrap iface.Bootstrap, conn net.Conn, connId uint32, maxPackageSize int) iface.Connection

func NewConnManager

func NewConnManager() iface.ConnManager

func NewPipeline

func NewPipeline(conn iface.Connection) iface.Pipeline

func NewRequest

func NewRequest(conn iface.Connection, msg []byte) iface.Request

Types

type ChannelContext

type ChannelContext struct {
	context.Context
	// contains filtered or unexported fields
}

func NewContext

func NewContext(ctx context.Context, pipeline iface.Pipeline, handler iface.ChannelHandler) *ChannelContext

func (*ChannelContext) DoHandle

func (c *ChannelContext) DoHandle(msg []byte)

DoHandle 调用当前处理器处理消息

func (*ChannelContext) FireRead

func (c *ChannelContext) FireRead(msg []byte)

FireRead 调用链表当中的下一个处理器

func (*ChannelContext) GetConnection

func (c *ChannelContext) GetConnection() iface.Connection

func (*ChannelContext) GetHandler

func (c *ChannelContext) GetHandler() iface.ChannelHandler

type ConnManager

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

func (*ConnManager) Add

func (c *ConnManager) Add(conn iface.Connection)

func (*ConnManager) Clear

func (c *ConnManager) Clear()

func (*ConnManager) Get

func (c *ConnManager) Get(connId uint32) (iface.Connection, bool)

func (*ConnManager) Remove

func (c *ConnManager) Remove(connId uint32)

func (*ConnManager) Size

func (c *ConnManager) Size() int

type Connection

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

func (*Connection) AddCronFunc

func (c *Connection) AddCronFunc(spec string, cmd func()) error

func (*Connection) GetConn

func (c *Connection) GetConn() net.Conn

func (*Connection) GetConnID

func (c *Connection) GetConnID() uint32

func (*Connection) GetPipeline

func (c *Connection) GetPipeline() iface.Pipeline

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() net.Addr

func (*Connection) RemoveCronFunc

func (c *Connection) RemoveCronFunc(id cron.EntryID)

func (*Connection) Start

func (c *Connection) Start()

func (*Connection) StartReader

func (c *Connection) StartReader()

func (*Connection) StartWriter

func (c *Connection) StartWriter()

StartWriter 实现写入器

func (*Connection) Stop

func (c *Connection) Stop()

func (*Connection) Write

func (c *Connection) Write(msg []byte) error

type Pipeline

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

func (*Pipeline) AddLast

func (p *Pipeline) AddLast(handler iface.ChannelHandler)

func (*Pipeline) GetConnection

func (p *Pipeline) GetConnection() iface.Connection

func (*Pipeline) Handle

func (p *Pipeline) Handle(msg []byte)

type Request

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

func (*Request) GetConn

func (r *Request) GetConn() iface.Connection

func (*Request) GetMsg

func (r *Request) GetMsg() []byte

Jump to

Keyboard shortcuts

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