
nano开源库学习
这一切没有想象那么糟
游戏开发,数据分析,机器学习,萌娃的爸爸
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
go开源网络库nano(11)-节点
前言定义// Options contains some configurations for current nodetype Options struct { Pipeline pipeline.Pipeline IsMaster bool AdvertiseAddr string RetryInterval time.Duration Client...原创 2019-12-26 18:31:49 · 438 阅读 · 0 评论 -
go开源网络库nano(2)-集群和节点
前言第一篇只要介绍了nano 库的一些概念,这篇主要讲解代码部分。因为这个库作者还是不断完善中,所以后续可能会有变动。作者已经在最初版本上加入了cluster,集群等概念。结构cluster集群cluster 包含有多个nano节点每个nano都提供一组不同的服务。所有服务需求从客户端开始,并向前推进到适当的节点。// cluster represents a nano cluste...原创 2019-12-23 20:46:03 · 1326 阅读 · 0 评论 -
go开源网络库nano(4)--网络库
前言底层网络库,提供了一套接口,后续的agent,acceptor,group 等类都会实现这些接口NetworkEntity定义network entity表示可用于构造会话对象的网络实体。type message struct { route string data interface{}}// NetworkEntity represents an network en...原创 2019-12-24 17:19:02 · 629 阅读 · 0 评论 -
go开源网络库nano(3)-会话session
前言原创 2019-12-24 17:20:09 · 540 阅读 · 0 评论 -
go开源网络库nano(5)-代理
前言代理 agent与用户对应的代理,用于存储原始连接信息// Agent corresponding a user, used for store raw conn information agent struct { // regular agent member session *session.Session // session conn net.Co...原创 2019-12-25 13:58:14 · 370 阅读 · 0 评论 -
go开源网络库nano(6)-hander逻辑
hander前言hander 定义方法1. 注册服务本地服远程服务2. 获取服务本地远程3. 查找远程服务4. 处理调用包的处理消息处理本地调用处理远程调用处理下一章前言package cluster注册服务头文件 hander.gohander 定义type LocalHandler struct { localServices map[string]*component.Se...原创 2019-12-25 16:08:30 · 483 阅读 · 0 评论 -
go开源网络库nano(7)-消息
前言原创 2019-12-25 18:06:38 · 566 阅读 · 0 评论 -
go开源网络库nano(1)--概论
前言最近感觉自己看书学习的时间太少了,需要补充能量,系统学习些东西。在学习golang,通过github上的这个nano库学习,可以利用golang把之前的业务流程从golang的角度看看。nanogithub:https://github.com/lonng/nano文档是这样介绍的:Nano是一个易于使用、快速、轻量级的游戏服务器网络库。它提供了一个核心网络体系结构以及一系列工具和...原创 2019-12-20 16:56:36 · 2304 阅读 · 0 评论 -
go开源网络库nano(9)-服务
服务前言定义方法下一章前言package component服务会把注册的组件,分解,把其中符合条件的hander分解成方法。定义//Handler represents a message.Message's handler's meta information. //Handler represents a message.Message's handler's meta in...原创 2019-12-26 13:54:43 · 567 阅读 · 0 评论 -
go开源网络库nano(10)-消息协议
消息协议前言协议格式Nano PackagePackage Format握手协议握手请求:握手响应:握手的流程:心跳协议心跳的流程数据协议服务器主动断开Nano Message消息头flag消息类型(Message Type)路由压缩标志(Route Compression Flag)前言nano 的消息协议协议格式nano的二进制协议包含两层编码:package和message。me...原创 2019-12-26 11:12:09 · 1694 阅读 · 0 评论 -
go开源网络库nano(8)-组件
component前言定义方法1. 注册2.获取组件列表下一章前言package component组件定义//Component 组件的接口type Component interface { Init() AfterInit() BeforeShutdown() Shutdown()}// base 是基本的,默认的实现type Base struct{}/...原创 2019-12-25 18:30:58 · 626 阅读 · 0 评论