ziface

package
v0.0.12-entry Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandleFunc

type HandleFunc = func(request IRequest)

type IConnManager

type IConnManager interface {
	Add(conn IConnection)
	Remove(conn IConnection)
	Get(connID uint64) (IConnection, error)
	Len() int
	ClearConn()
}

type IConnection

type IConnection interface {
	Start(ctx context.Context)
	Stop()
	GetTCPConnection() *net.TCPConn
	GetConnID() uint64
	RemoteAddr() net.Addr
	SendMsg(id uint32, data []byte) error
	SetProperty(key string, value any)
	GetProperty(key string) (any, bool)
	RemoveProperty(key string)
}

type IDataPack

type IDataPack interface {
	GetHeadLen() uint32
	Pack(msg IMessage) ([]byte, error)
	Unpack([]byte) (IMessage, error)
}

type IMessage

type IMessage interface {
	GetDataLen() uint32
	GetMsgID() uint32
	GetData() []byte
	SetData([]byte)
}

type IMsgHandle

type IMsgHandle interface {
	DoMsgHandle(request IRequest)
	AddRouter(msgID uint32, handle HandleFunc)
	StarWorkerPool()
	SendMsgToTaskQueue(request IRequest)
}

type IRequest

type IRequest interface {
	GetConnection() IConnection
	GetData() []byte
	GetMsgID() uint32
}

type IServer

type IServer interface {
	Start()
	Stop()
	Serve()
	Config() *zconfig.ZConfig
	AddRouter(msgID uint32, handle HandleFunc)
	GetConnMgr() IConnManager
	SetOnConnStart(func(conn IConnection))
	SetOnConnStop(func(conn IConnection))
	CallOnConnStart(conn IConnection)
	CallOnConnStop(conn IConnection)
	NotifyClose(conn IConnection)
}

Jump to

Keyboard shortcuts

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