ExESDB.Commanded.ProjectionsRebuilder (ex_esdb_commanded v0.9.0)
Generic projection rebuilder for ExESDB Commanded applications.
Provides facilities for:
- Rebuilding specific projections
- Rebuilding all projections
- Tracking rebuild progress
- Handling rebuild failures
- Supporting concurrent rebuilds
Summary
Functions
Returns a specification to start this module under a supervisor.
Rebuilds all projections for the configured Commanded application.
Rebuilds specific projections.
Starts the rebuilder for a specific Commanded application.
Gets the current status of projection rebuilds.
Types
@type projection_info() :: %{ name: module(), status: rebuild_status(), started_at: DateTime.t() | nil, completed_at: DateTime.t() | nil, error: any() }
@type rebuild_opts() :: [ application: module(), timeout: non_neg_integer(), batch_size: pos_integer(), concurrency: pos_integer() ]
@type rebuild_status() :: :not_started | :in_progress | :completed | :failed
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec rebuild_all(rebuild_opts()) :: {:ok, [projection_info()]} | {:error, term()}
Rebuilds all projections for the configured Commanded application.
@spec rebuild_projections([module()], rebuild_opts()) :: {:ok, [projection_info()]} | {:error, term()}
Rebuilds specific projections.
Options:
- :timeout - Maximum time to wait for rebuild (default: 30_000ms)
- :batch_size - Events to process in each batch (default: 1000)
- :concurrency - Number of concurrent rebuilds (default: 1)
Starts the rebuilder for a specific Commanded application.
@spec status(keyword()) :: %{projections: [projection_info()]}
Gets the current status of projection rebuilds.