Class BulkOutcomeRecorder

java.lang.Object
ai.attackframework.tools.burp.sinks.BulkOutcomeRecorder

public final class BulkOutcomeRecorder extends Object
Shared bulk-outcome accounting for OpenSearch bulk requests across reporters.

Centralizes the success/failure bookkeeping that one-shot and periodic reporters (Sitemap, Findings, and — via TrafficRouteBucket.recordBulkOutcome(ai.attackframework.tools.burp.sinks.TrafficRouteBucket.Route, int, int, boolean, java.lang.String) — the traffic reporters) would otherwise duplicate. Callers invoke this helper once per bulk request.

Side effects when openSearchActive is true:

Counts are clamped so sent is bounded to [0, max(0, attempted)]; this makes the helper self-defending against caller bugs that report more successes than attempts.

When openSearchActive is false, the helper returns the clamped success count but updates no counters (file-sink accounting is handled elsewhere).

  • Method Details

    • record

      public static int record(String indexKey, String logPrefix, String label, int attempted, int sent, boolean openSearchActive)
      Records the outcome of one bulk request for indexKey.
      Parameters:
      indexKey - logical index key (for example "traffic", "sitemap", "findings"); must not be null or blank
      logPrefix - short bracket prefix used in panel log lines (for example "Traffic", "Sitemap"); falls back to "Export" when blank or null
      label - human-readable label describing what the bulk represents (for example "Bulk push", "Proxy history chunk"); falls back to "Bulk" when blank or null
      attempted - number of documents submitted in the bulk; negative values are clamped to 0
      sent - number of documents acknowledged successful; clamped to [0, max(0, attempted)]
      openSearchActive - whether the OpenSearch sink was active for this bulk
      Returns:
      the clamped success count (useful when callers need to decide whether the batch was fully pushed)
      Throws:
      IllegalArgumentException - if indexKey is null or blank