Class DownloadScheduler

java.lang.Object
google.registry.bsa.persistence.DownloadScheduler

public final class DownloadScheduler extends Object
Assigns work for each cron invocation of the BSA Download job.

The download job is invoked at a divisible fraction of the desired data freshness to accommodate potential retries. E.g., for 30-minute data freshness with up to two retries on error, the cron schedule for the job should be set to 10 minutes.

The processing of each BSA download progresses through multiple stages as described in DownloadStage until it reaches one of the terminal stages. Each stage is check-pointed on completion, therefore if an invocation fails mid-process, the next invocation will skip the completed stages. No new downloads will start as long as the most recent one is still being processed.

When a new download is scheduled, the block list checksums from the most recent completed job is included. If the new checksums match the previous ones, the download may be skipped and the job should terminate in the NOP stage. However, if the checksums have stayed unchanged for longer than the user-provided maxNopInterval, the download will be processed.

The BSA downloads contains server-provided checksums. If they do not match the checksums generated on Nomulus' side, the download is skipped and the job should terminate in the CHECKSUMS_NOT_MATCH stage.

  • Method Details

    • schedule

      public Optional<DownloadSchedule> schedule()
      Returns a DownloadSchedule instance that describes the work to be performed by an invocation of the download action, if applicable; or Optional.empty() when there is nothing to do.

      For an interrupted job, work will resume from the DownloadSchedule.stage.

    • fetchMostRecentDownloadJobIdIfCompleted

      public static Optional<String> fetchMostRecentDownloadJobIdIfCompleted()
      Returns the most recent download jobName if it has been fully processed, and empty if the download is still being processed.