ProposePeerRemoval proposes a new configuration with the peer with the given id removed.
(ctx context.Context, id uint64)
| 612 | |
| 613 | // ProposePeerRemoval proposes a new configuration with the peer with the given id removed. |
| 614 | func (n *Node) ProposePeerRemoval(ctx context.Context, id uint64) error { |
| 615 | if n.Raft() == nil { |
| 616 | return ErrNoNode |
| 617 | } |
| 618 | if _, ok := n.Peer(id); !ok && id != n.RaftContext.Id { |
| 619 | return errors.Errorf("Node %#x not part of group", id) |
| 620 | } |
| 621 | cc := raftpb.ConfChange{ |
| 622 | Type: raftpb.ConfChangeRemoveNode, |
| 623 | NodeID: id, |
| 624 | } |
| 625 | err := errInternalRetry |
| 626 | for err == errInternalRetry { |
| 627 | err = n.ProposeConfChange(ctx, cc) |
| 628 | } |
| 629 | return err |
| 630 | } |
| 631 | |
| 632 | type linReadReq struct { |
| 633 | // A one-shot chan which we send a raft index upon. |
no test coverage detected