public Optional getLatestCompletedCheckpoint()

in flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/CheckpointHistoryWrapper.java [77:94]


    public Optional<CompletedCheckpointInfo> getLatestCompletedCheckpoint() {
        if (latestCheckpoints == null) {
            return Optional.empty();
        }

        var latestCheckpoint = getCheckpointInfo(FIELD_NAME_RESTORED).orElse(null);

        var completed = getCheckpointInfo(FIELD_NAME_COMPLETED).orElse(null);
        if (latestCheckpoint == null || (completed != null && completed.id > latestCheckpoint.id)) {
            latestCheckpoint = completed;
        }
        var savepoint = getCheckpointInfo(FIELD_NAME_SAVEPOINT).orElse(null);
        if (latestCheckpoint == null || (savepoint != null && savepoint.id > latestCheckpoint.id)) {
            latestCheckpoint = savepoint;
        }

        return Optional.ofNullable(latestCheckpoint);
    }