lxd/db/raft.go
func (n *NodeTx) RaftNodesReplace(nodes []RaftNode) error {
	_, err := n.tx.Exec("DELETE FROM raft_nodes")
	if err != nil {
		return err
	}

	columns := []string{"id", "address"}
	for _, node := range nodes {
		values := []interface{}{node.ID, node.Address}
		_, err := query.UpsertObject(n.tx, "raft_nodes", columns, values)
		if err != nil {
			return err
		}
	}
	return nil
}
func (n *NodeTx) RaftNodesReplace(nodes []RaftNode) error {
	_, err := n.tx.Exec("DELETE FROM raft_nodes")
	if err != nil {
		return err
	}

	columns := []string{"id", "address"}
	for _, node := range nodes {
		values := []interface{}{node.ID, node.Address}
		_, err := query.UpsertObject(n.tx, "raft_nodes", columns, values)
		if err != nil {
			return err
		}
	}
	return nil
}
// RaftNodesReplace replaces the current list of raft nodes.