聊聊kingbus的membership_handler.go
序 本文主要研究一下kingbus的membership_handler.go GetMembers kingbus/api/membership_handler.go //GetMembers implements get information of membership, not include lead information func (h *MembershipHandler) GetMembers(echoCtx echo.Context) error { members := h.cluster.Members() return echoCtx.JSON(http.StatusOK, utils.NewResp().SetData(members)) } GetMembers方法主要是通过h.cluster.Members()获取members,然后json化 AddMember kingbus/api/membership_handler.go //AddMember implements add a member into raft cluster func (h *MembershipHandler) AddMember(echoCtx echo.Context) error { args := struct { NodeName string `json: