raft/rawnode.go
func (rn *RawNode) ApplyConfChange(cc pb.ConfChange) *pb.ConfState {
	if cc.NodeID == None {
		return &pb.ConfState{Nodes: rn.raft.nodes(), Learners: rn.raft.learnerNodes()}
	}
	switch cc.Type {
	case pb.ConfChangeAddNode:
		rn.raft.addNode(cc.NodeID)
	case pb.ConfChangeAddLearnerNode:
		rn.raft.addLearner(cc.NodeID)
	case pb.ConfChangeRemoveNode:
		rn.raft.removeNode(cc.NodeID)
	case pb.ConfChangeUpdateNode:
	default:
		panic("unexpected conf type")
	}
	return &pb.ConfState{Nodes: rn.raft.nodes(), Learners: rn.raft.learnerNodes()}
}
func (rn *RawNode) ApplyConfChange(cc pb.ConfChange) *pb.ConfState {
	if cc.NodeID == None {
		return &pb.ConfState{Nodes: rn.raft.nodes(), Learners: rn.raft.learnerNodes()}
	}
	switch cc.Type {
	case pb.ConfChangeAddNode:
		rn.raft.addNode(cc.NodeID)
	case pb.ConfChangeAddLearnerNode:
		rn.raft.addLearner(cc.NodeID)
	case pb.ConfChangeRemoveNode:
		rn.raft.removeNode(cc.NodeID)
	case pb.ConfChangeUpdateNode:
	default:
		panic("unexpected conf type")
	}
	return &pb.ConfState{Nodes: rn.raft.nodes(), Learners: rn.raft.learnerNodes()}
}
func ( rn * RawNode ) ApplyConfChange ( cc pb . ConfChange ) * pb . ConfState { if cc . NodeID == None { return & pb . ConfState { Nodes : rn . raft . nodes ( ) , Learners : rn . raft . learnerNodes ( ) } } switch cc . Type { case pb . ConfChangeAddNode : rn . raft . addNode ( cc . NodeID ) case pb . ConfChangeAddLearnerNode : rn . raft . addLearner ( cc . NodeID ) case pb . ConfChangeRemoveNode : rn . raft . removeNode ( cc . NodeID ) case pb . ConfChangeUpdateNode : default : panic ( " " ) } return & pb . ConfState { Nodes : rn . raft . nodes ( ) , Learners : rn . raft . learnerNodes ( ) } }
// ApplyConfChange applies a config change to the local node.
ApplyConfChange applies a config change to the local node .