pub struct MigrationController { /* private fields */ }Expand description
Manages the state machine for a single migration.
It owns lifecycle transitions, progress, skips, and diagnostics but not model routing. See docs/migration.md for its transition and accounting rules.
Implementations§
Source§impl MigrationController
impl MigrationController
Sourcepub fn new(plan: MigrationPlan) -> Self
pub fn new(plan: MigrationPlan) -> Self
Create a new migration controller from a plan.
Sourcepub fn start(&mut self) -> Result<(), MigrationError>
pub fn start(&mut self) -> Result<(), MigrationError>
Start the migration (Planned -> InProgress).
Sourcepub fn record_progress(
&mut self,
newly_processed: usize,
) -> Result<(), MigrationError>
pub fn record_progress( &mut self, newly_processed: usize, ) -> Result<(), MigrationError>
Record that newly_processed embeddings were completed.
Sourcepub fn record_error(&mut self)
pub fn record_error(&mut self)
Record a non-fatal error during processing.
Sourcepub fn record_skip(&mut self, reason: SkipReason) -> Result<(), MigrationError>
pub fn record_skip(&mut self, reason: SkipReason) -> Result<(), MigrationError>
Record an item that will be permanently skipped.
Skips reduce the effective completion total but require a later progress call to transition to completed. See docs/migration.md.
Sourcepub fn skip_reasons(&self) -> &[SkipReason]
pub fn skip_reasons(&self) -> &[SkipReason]
Returns the list of reasons why entries were skipped during migration.
Sourcepub fn effective_coverage(&self) -> f64
pub fn effective_coverage(&self) -> f64
Returns processed-to-effective-total coverage; a zero effective total returns 1.0.
Sourcepub fn pause(&mut self, reason: impl Into<String>) -> Result<(), MigrationError>
pub fn pause(&mut self, reason: impl Into<String>) -> Result<(), MigrationError>
Pause the migration (InProgress -> Paused).
Sourcepub fn resume(&mut self) -> Result<(), MigrationError>
pub fn resume(&mut self) -> Result<(), MigrationError>
Resume the migration (Paused/Failed -> InProgress).
Sourcepub fn fail(&mut self, error: impl Into<String>) -> Result<(), MigrationError>
pub fn fail(&mut self, error: impl Into<String>) -> Result<(), MigrationError>
Fail the migration (InProgress -> Failed).
Sourcepub fn cancel(&mut self) -> Result<(), MigrationError>
pub fn cancel(&mut self) -> Result<(), MigrationError>
Cancel the migration (any non-terminal state -> Cancelled).
Sourcepub fn progress(&self) -> MigrationProgress
pub fn progress(&self) -> MigrationProgress
Get a snapshot of current progress.
Sourcepub fn state(&self) -> &MigrationState
pub fn state(&self) -> &MigrationState
Returns the current migration state.
Sourcepub fn plan(&self) -> &MigrationPlan
pub fn plan(&self) -> &MigrationPlan
Returns the migration plan.