最新

认识RPC

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

By huizhou92

tech

RPC实践 EP2: Protobuf与 它的插件系统。

在上一篇文章中,我用net/rpc 包实现了一个简单的 RPC接口,并且尝试了net/rpc自带的Gob编码以及JSON编码,学习了Golang RPC 的一些基本知识。本篇文章,我会将net/rpc 跟 protobuf结合起来,然后在了解一下如何使用Protobuf + 插件 生成 gRPC 的代码。 最后会尝试创建一个自己的protobuf插件来帮助我们生成代码,开始吧。 This article was first published in the Medium MPP plan. If you are a Medium user, please follow me on Medium. Thank you very much. 我们在工作过程中一定使用过gRPC + protobuf ,但是它们两个并不是绑定关系,

By huizhou92