pub struct RebaseStateMachine { /* private fields */ }Expand description
State machine for fault-tolerant rebase operations.
This state machine manages rebase operations with:
- Checkpoint-based persistence
- Automatic recovery from interruptions
- Maximum recovery attempt limits
- Conflict tracking
Implementations§
Source§impl RebaseStateMachine
impl RebaseStateMachine
Sourcepub fn new(upstream_branch: String) -> Self
pub fn new(upstream_branch: String) -> Self
Create a new state machine for a rebase operation.
§Arguments
upstream_branch- The branch to rebase onto
Sourcepub fn load_or_create(upstream_branch: String) -> Result<Self>
pub fn load_or_create(upstream_branch: String) -> Result<Self>
Load an existing state machine from checkpoint or create a new one.
If a checkpoint exists, this will resume from that state. Otherwise, creates a new state machine.
This method handles corrupted checkpoints by:
- Attempting to load backup checkpoint
- Creating a fresh state if checkpoint is completely corrupted
§Arguments
upstream_branch- The branch to rebase onto (used if no checkpoint exists)
§Returns
Returns Ok(state_machine) if successful, or an error if loading fails.
Sourcepub fn with_max_recovery_attempts(self, max: u32) -> Self
pub fn with_max_recovery_attempts(self, max: u32) -> Self
Set the maximum number of recovery attempts.
Sourcepub fn transition_to(&mut self, phase: RebasePhase) -> Result<()>
pub fn transition_to(&mut self, phase: RebasePhase) -> Result<()>
Sourcepub fn record_conflict(&mut self, file: String)
pub fn record_conflict(&mut self, file: String)
Sourcepub fn record_resolution(&mut self, file: String)
pub fn record_resolution(&mut self, file: String)
Sourcepub fn record_error(&mut self, error: String)
pub fn record_error(&mut self, error: String)
Sourcepub fn all_conflicts_resolved(&self) -> bool
pub fn all_conflicts_resolved(&self) -> bool
Check if all conflicts have been resolved.
Returns true if all conflicted files have been marked as resolved.
Sourcepub fn checkpoint(&self) -> &RebaseCheckpoint
pub fn checkpoint(&self) -> &RebaseCheckpoint
Get the current checkpoint.
Sourcepub fn phase(&self) -> &RebasePhase
pub fn phase(&self) -> &RebasePhase
Get the current phase.
Sourcepub fn upstream_branch(&self) -> &str
pub fn upstream_branch(&self) -> &str
Get the upstream branch.
Sourcepub fn unresolved_conflict_count(&self) -> usize
pub fn unresolved_conflict_count(&self) -> usize
Get the number of unresolved conflicts.
Sourcepub fn clear_checkpoint(self) -> Result<()>
pub fn clear_checkpoint(self) -> Result<()>
Clear the checkpoint (typically on successful completion).
Auto Trait Implementations§
impl Freeze for RebaseStateMachine
impl RefUnwindSafe for RebaseStateMachine
impl Send for RebaseStateMachine
impl Sync for RebaseStateMachine
impl Unpin for RebaseStateMachine
impl UnwindSafe for RebaseStateMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more