V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
herozem
V2EX  ›  分享创造

用 gRPC 造了一个剪贴板。顺便说说用 gRPC 和 thrift 的几点感受

  •  
  •   herozem · 2018-04-10 23:27:00 +08:00 · 2884 次点击
    这是一个创建于 2180 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/jiajunhuang/pasty

    公司的项目用了 thrift,所以自己整 gRPC 来玩玩。以后就可以愉快的到处复制粘贴了。

    感受:

    • RPC 比 RESTful 好用多了。。。虽然 RESTful 更加跨平台
    • protobuf 不能使用"原始类型"例如 string,int64 等作为 rpc 调用的参数。必需包装在 message 里。这一点 很蛋疼。对比起来 thrift 好用一些。
    • thrift-compiler 老版本生成的 go 代码居然不能用,这是一个大坑。
    • 据说 gRPC 的工具链比 thrift 丰富?例如监控等?

    看看 pasty 的使用:

    jiajun@idea ~: type p
    p is /home/jiajun/golang/bin/p
    jiajun@idea ~: echo "hello" > test.txt
    jiajun@idea ~: p < test.txt
    jiajun@idea ~: p -limit 1
    file id 3 created at 2018-04-10 23:19:03 +0800 CST      ==================
    hello
    file id 3 created at 2018-04-10 23:19:03 +0800 CST over ==================
    jiajun@idea ~: p -limit 1 -hint=false
    hello
    jiajun@idea ~: echo "hello world" | p
    jiajun@idea ~: p -limit 1 -hint=false
    hello world
    jiajun@idea ~: p -limit 2 -hint=false
    hello world
    hello
    jiajun@idea ~: p -limit 2
    file id 4 created at 2018-04-10 23:19:35 +0800 CST      ==================
    hello world
    file id 4 created at 2018-04-10 23:19:35 +0800 CST over ==================
    file id 3 created at 2018-04-10 23:19:03 +0800 CST      ==================
    hello
    file id 3 created at 2018-04-10 23:19:03 +0800 CST over ==================
    
    wwwker
        1
    wwwker  
       2018-04-11 15:26:38 +08:00
    最近项目里面也整合了 grpc,确实还不错
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2636 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:33 · PVG 23:33 · LAX 08:33 · JFK 11:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.