7.Thrift指南 thrift go源码解读 2


前言: 于是有了这一篇...

⚠️thrift go源码版本 0.11.0

  1. SimpleServer流程图

1.SimpleServer流程图

上一章我们领略了整个SimpleServer结构及其方法,这里通过上一章代码可以很容易绘制出架构的流程图,让我们可以有一个直观的认识,如下图:


7.Thrift指南 thrift go源码解读 2_第1张图片

可以看出这是一个标准的开发tcp服务端处理流程,正如上一章头注释诠释那样它就是一个TThreadedServer服务。

# 这是一个典型的TSimpleServer服务,因为它在接收套接字后不会阻塞。
# 它更像一个TThreadedServer服务,可以在不同的goroutine中处理连接。
# 如果在golang客户端实现连接池之类的东西就可以工作了。
/*
 * This is not a typical TSimpleServer as it is not blocked after accept a socket.
 * It is more like a TThreadedServer that can handle different connections in different goroutines.
 * This will work if golang user implements a conn-pool like thing in client side.
 */

总结

整个服务是非常简单标准的架构方式,下一章继续深入细节。

附录:
go Tcp

你可能感兴趣的:(7.Thrift指南 thrift go源码解读 2)