爱意满满的作品展示区。
herozem

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

  •  
  •   herozem · Apr 10, 2018 · 3881 views
    This topic created in 2975 days ago, the information mentioned may be changed or developed.

    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  
       Apr 11, 2018
    最近项目里面也整合了 grpc,确实还不错
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3407 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 31ms · UTC 00:34 · PVG 08:34 · LAX 17:34 · JFK 20:34
    ♥ Do have faith in what you're doing.