Class BatchSizeController
java.lang.Object
ai.attackframework.tools.burp.utils.opensearch.BatchSizeController
Single shared controller for batch size (doc count per OpenSearch bulk request).
Grows on success (with smoothing) and shrinks on failure; used by all reporters
and
IndexingRetryCoordinator. Bounds are fixed in code; effective range
is driven only by success/failure observations. Thread-safe.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current batch size (doc count) to use for the next bulk request.static BatchSizeControllervoidrecordFailure(int attemptedDocs) Call after a bulk request failed (full failure, 429, timeout, or partial success).voidrecordPartialSuccess(int successCount, int total) Optional: treat partial success as failure for scaling (conservative).voidrecordSuccess(int docsSent) Call after a bulk request fully succeeded.voidsetOnChangeListener(Consumer<Integer> listener) Registers a listener called when the batch size changes (for StatsPanel refresh and tool index).
-
Constructor Details
-
BatchSizeController
public BatchSizeController()Constructs the controller. Instance is set bygetInstance()or by tests viasetInstance(BatchSizeController).
-
-
Method Details
-
getInstance
-
getCurrentBatchSize
public int getCurrentBatchSize()Returns the current batch size (doc count) to use for the next bulk request. -
recordSuccess
public void recordSuccess(int docsSent) Call after a bulk request fully succeeded. May increase batch size (with smoothing).- Parameters:
docsSent- number of documents successfully sent in this bulk
-
recordFailure
public void recordFailure(int attemptedDocs) Call after a bulk request failed (full failure, 429, timeout, or partial success). Decreases batch size.- Parameters:
attemptedDocs- number of documents that were in the failed bulk
-
recordPartialSuccess
public void recordPartialSuccess(int successCount, int total) Optional: treat partial success as failure for scaling (conservative).- Parameters:
successCount- number of docs that succeededtotal- total docs in the bulk
-
setOnChangeListener
Registers a listener called when the batch size changes (for StatsPanel refresh and tool index). Invoked from the thread that calledrecordSuccess(int)orrecordFailure(int).
-