public Node withPreferToRetire(boolean preferToRetire, Agent agent, Instant at) {
        if (preferToRetire == status.preferToRetire()) return this;
        Node node = this.with(status.withPreferToRetire(preferToRetire));
        if (preferToRetire) {
            node = node.with(history.with(new History.Event(History.Event.Type.preferToRetire, agent, at)));
        }
        return node;
    }
Returns a copy of this node with preferToRetire set to given value and updated history
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java