tech
认识RPC
RPC是远程过程调用的简称,是分布式系统中不同节点间流行的通信方式。是互联网时代的基石技术,Go语言的标准库也提供了一个简单的RPC实现,Go语言的RPC包的路径为net/rpc,本篇文章的目的是利用net/rpc 实现一个简单的RPC 接口,帮助我们拨开RPC 的迷雾。 对 net/rpc 而言,一个函数需要能够被远程调用,需要满足如下五个条件: * the method’s type is exported. * the method is exported. * the method has two arguments, both exported (or builtin) types. * the method’s second argument is a pointer. * the method has return