Class RunListData

java.lang.Object
jenkins.widgets.RunListData
Direct Known Subclasses:
BuildListTable, BuildTimeTrend

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public abstract class RunListData extends Object
Serves a page of some information from a RunList as JSON.

Runs are expected newest first, ordered by Run.getTimeInMillis(), as RunList provides them. A page holds matching runs strictly older than the olderThan cursor; the response's next is the cursor for the following page, or null once there are no more runs. Runs sharing a timestamp are never split across pages, so the cursor is an exact boundary.

A filter (such as runs related to a user) may reject many runs before a page is full, so a page may be cut short once SCAN_BUDGET_MS has elapsed, in which case partial is set. The cursor then covers every run examined, matching or not, and the client should request the rest of the page, with limit set to the runs it still needs, until it has pageSize runs. The budget starts at the first run older than the cursor, so that reaching the cursor does not use it up.

  • Field Details

    • PAGE_SIZE

      public static int PAGE_SIZE
    • SCAN_BUDGET_MS

      public static long SCAN_BUDGET_MS
  • Constructor Details

    • RunListData

      public RunListData()
  • Method Details

    • serve

      public org.kohsuke.stapler.HttpResponse serve(Iterable<? extends Run<?,?>> builds, @CheckForNull String olderThan, @CheckForNull String limit)
      Serves one page of runs.
      Parameters:
      builds - runs, newest first
      olderThan - cursor from a previous page's next, or null for the first page
    • serve

      public org.kohsuke.stapler.HttpResponse serve(Iterable<? extends Run<?,?>> builds, Predicate<? super Run<?,?>> filter, @CheckForNull String olderThan, @CheckForNull String limit)
      Serves one page of the runs matching a filter.
      Parameters:
      builds - runs, newest first, not yet filtered, so that the scan budget covers the runs the filter rejects
      filter - selects the runs to include
      olderThan - cursor from a previous page's next, or null for the first page
      limit - the runs still needed to fill a page cut short, or null for a whole page
    • calculate

      protected abstract void calculate(Run<?,?> build, net.sf.json.JSONObject element)