Giter VIP home page Giter VIP logo

annotate-grpc-go's Introduction

源码注解

基于34384f34de585705f1a6783a158d2ec8af29f618

切换到note分支 建议使用ide的代码提示和跳转等功能阅读, 所以目录结构要正确 可以:

cd $GOPATH/google.golang.org/
git clone https://github.com/liangzhiyang/annotate-grpc-go.git
mv annotate-grpc-go grpc

如果 grpc 已经存在

cd $GOPATH/google.golang.org/grpc
git remote add lzy  https://github.com/liangzhiyang/annotate-grpc-go.git
git fetch --all
git checkout -b note lzy/note

建议阅读顺序(细节不列)

  • grpc.Dial() //建立连接的过程
(cc *ClientConn) resetAddrConn
(ac *addrConn) resetTransport
(ac *addrConn) transportMonitor //单独的goroutine,管理transport
transport.newHTTP2Client
(t *http2Client) reader() //单独的goroutine,读取服务端的帧数据
  • grpc.Invoke() //一次rpc请求的过程
(cc *ClientConn) getTransport
(ac *addrConn) wait
sendRequest()
recvResponse()

持续更新~~~~

准备接下来列举几种情况说明client端遇到意外情况的代码执行流程(使用balancer)

grpc源码注解(golang)

grpc的dial正常执行流程

grpc服务异常情况的执行流程

grpc的invoke(一次请求)正常执行流程

个人源码学习总结:

1、负载均衡https://segmentfault.com/a/1190000015231956

2、transport

2.1流控https://segmentfault.com/a/1190000015232494

2.2客户端 服务端https://segmentfault.com/a/1190000015237382?_ea=3846950

annotate-grpc-go's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.