You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.1 KiB

4 years ago
4 years ago
4 years ago
  1. // Package ziface 主要提供zinx全部抽象层接口定义.
  2. // 包括:
  3. // IServer 服务mod接口
  4. // IRouter 路由mod接口
  5. // IConnection 连接mod层接口
  6. // IMessage 消息mod接口
  7. // IDataPack 消息拆解接口
  8. // IMsgHandler 消息处理及协程池接口
  9. //
  10. // 当前文件描述:
  11. // @Title iserver.go
  12. // @Description 提供Server抽象层全部接口声明
  13. // @Author Aceld - Thu Mar 11 10:32:29 CST 2019
  14. package ziface
  15. //定义服务接口
  16. type IServer interface {
  17. Start() //启动服务器方法
  18. Stop() //停止服务器方法
  19. Serve() //开启业务服务方法
  20. AddRouter(msgID uint32, router IRouter) //路由功能:给当前服务注册一个路由业务方法,供客户端链接处理使用
  21. GetConnMgr() IConnManager //得到链接管理
  22. SetOnConnStart(func(IConnection)) //设置该Server的连接创建时Hook函数
  23. SetOnConnStop(func(IConnection)) //设置该Server的连接断开时的Hook函数
  24. CallOnConnStart(conn IConnection) //调用连接OnConnStart Hook函数
  25. CallOnConnStop(conn IConnection) //调用连接OnConnStop Hook函数
  26. }