WeaviateEx.Batch.ErrorTracking.Results (WeaviateEx v0.7.4)

View Source

Aggregated results from a batch operation.

Tracks both successful and failed operations.

Memory Safety

To prevent memory exhaustion with very large batches, a maximum of 100,000 successful UUIDs are stored. When the limit is exceeded, oldest entries (lowest indices) are evicted using a rolling window strategy. Use max_stored_results/0 to get the current limit.

Summary

Functions

Add an error (object or reference) to the results.

Record a successful object insertion with its index and UUID.

Get errors list.

Check if any errors occurred during the batch operation.

Get the maximum number of stored results.

Create a new empty results struct.

Get the total number of errors (objects + references).

Check if results are within the maximum stored limit.

Set the elapsed time for the batch operation.

Get statistics summary for the results.

Types

t()

@type t() :: %WeaviateEx.Batch.ErrorTracking.Results{
  elapsed_seconds: float(),
  failed_objects: [WeaviateEx.Batch.ErrorTracking.ErrorObject.t()],
  failed_references: [WeaviateEx.Batch.ErrorTracking.ErrorReference.t()],
  successful_uuids: %{required(non_neg_integer()) => String.t()}
}

Functions

add_error(results, error)

Add an error (object or reference) to the results.

add_success(results, index, uuid)

@spec add_success(t(), non_neg_integer(), String.t()) :: t()

Record a successful object insertion with its index and UUID.

When the number of stored results exceeds the maximum (100,000), oldest entries (lowest indices) are evicted to prevent memory exhaustion.

errors(results)

Get errors list.

has_errors?(results)

@spec has_errors?(t()) :: boolean()

Check if any errors occurred during the batch operation.

max_stored_results()

@spec max_stored_results() :: pos_integer()

Get the maximum number of stored results.

Results beyond this limit will have oldest entries evicted.

new()

@spec new() :: t()

Create a new empty results struct.

number_errors(results)

@spec number_errors(t()) :: non_neg_integer()

Get the total number of errors (objects + references).

results_within_limit?(results)

@spec results_within_limit?(t()) :: boolean()

Check if results are within the maximum stored limit.

set_elapsed(results, seconds)

@spec set_elapsed(t(), float()) :: t()

Set the elapsed time for the batch operation.

statistics(results)

@spec statistics(t()) :: %{
  processed: non_neg_integer(),
  successful: non_neg_integer(),
  failed: non_neg_integer()
}

Get statistics summary for the results.

Returns a map with processed, successful, and failed counts.