- etcd server 和 client 之间的通信:
前面调用流程都是使用 v3api --> grpc + pb 封装起来的消息处理,从 Put 操作开始:
quota.go: func (s *quotaKVServer) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error)
key.go: func (s *kvServer) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error)
v3_server.go: func (s *EtcdServer) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error)
v3_server.go: func (s *EtcdServer) raftRequest(ctx context.Context, r pb.InternalRaftRequest) (proto.Message, error)
v3_server.go: func (s *EtcdServer) raftRequestOnce(ctx context.Context, r pb.InternalRaftRequest) (proto.Message, error)
v3_server.go: func (s *EtcdServer) processInternalRaftRequestOnce(ctx context.Context, r pb.InternalRaftRequest) (*applyResult, error)
- etcd server 各个节点之间的通信:
集群中个节点之间还在还是用 v2api 进行通信
server.go: func (s *EtcdServer) Start()
server.go: func (s *EtcdServer) publish(timeout time.Duration)
v2_server.go: func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error)
v2_server.go: func (r *RequestV2) Handle(ctx context.Context, v2api RequestV2Handler) (Response, error)
v2_server.go: func (a *reqV2HandlerEtcdServer) Put(ctx context.Context, r *RequestV2) (Response, error)
v2_server.go: func (a *reqV2HandlerEtcdServer) processRaftRequest(ctx context.Context, r *RequestV2) (Response, error)