func()

in api/datanode/ratis.go [67:93]


func (dnClient *DatanodeClient) sendRatisMessage(request ratis.RaftClientRequestProto) (ratis.RaftClientReplyProto, error) {
	resp, err := dnClient.sendRatisMessageToServer(request)
	if err != nil {
		return ratis.RaftClientReplyProto{}, err
	}
	if resp.GetNotLeaderException() != nil {
		err = dnClient.connectToNext()
		if err != nil {
			return ratis.RaftClientReplyProto{}, err
		}
		resp, err = dnClient.sendRatisMessageToServer(request)
		if err != nil {
			return ratis.RaftClientReplyProto{}, err
		}
	}
	if resp.GetNotLeaderException() != nil {
		err = dnClient.connectToNext()
		if err != nil {
			return ratis.RaftClientReplyProto{}, err
		}
		resp, err = dnClient.sendRatisMessageToServer(request)
		if err != nil {
			return ratis.RaftClientReplyProto{}, err
		}
	}
	return resp, nil
}