pub struct StateManager { /* private fields */ }Expand description
State manager for MapReduce jobs
Centralizes all state management operations including persistence, checkpointing, recovery, and state transitions.
Implementations§
Source§impl StateManager
impl StateManager
Sourcepub async fn create_checkpoint(
&self,
job_id: &str,
) -> Result<Checkpoint, StateError>
pub async fn create_checkpoint( &self, job_id: &str, ) -> Result<Checkpoint, StateError>
Create a checkpoint for the current job state
Sourcepub fn validate_checkpoint(&self, state: &JobState) -> Result<(), StateError>
pub fn validate_checkpoint(&self, state: &JobState) -> Result<(), StateError>
Validate a checkpoint for integrity
Sourcepub async fn get_checkpoint(
&self,
job_id: &str,
version: Option<u32>,
) -> Result<Option<Checkpoint>, StateError>
pub async fn get_checkpoint( &self, job_id: &str, version: Option<u32>, ) -> Result<Option<Checkpoint>, StateError>
Get a specific checkpoint version
Sourcepub async fn clean_old_checkpoints(
&self,
job_id: &str,
keep_count: usize,
) -> Result<(), StateError>
pub async fn clean_old_checkpoints( &self, job_id: &str, keep_count: usize, ) -> Result<(), StateError>
Clean old checkpoints, keeping only the most recent N
Source§impl StateManager
impl StateManager
Sourcepub async fn recover_from_checkpoint(
&self,
job_id: &str,
checkpoint_version: Option<u32>,
) -> Result<RecoveryPlan, StateError>
pub async fn recover_from_checkpoint( &self, job_id: &str, checkpoint_version: Option<u32>, ) -> Result<RecoveryPlan, StateError>
Create a recovery plan from a checkpoint
Sourcepub fn calculate_pending_items(
&self,
state: &JobState,
max_additional_retries: u32,
) -> Result<Vec<Value>, StateError>
pub fn calculate_pending_items( &self, state: &JobState, max_additional_retries: u32, ) -> Result<Vec<Value>, StateError>
Calculate pending items for resumption
Sourcepub async fn can_resume_job(&self, job_id: &str) -> bool
pub async fn can_resume_job(&self, job_id: &str) -> bool
Check if a job can be resumed
Sourcepub async fn apply_recovery_plan(
&self,
job_id: &str,
plan: &RecoveryPlan,
) -> Result<(), StateError>
pub async fn apply_recovery_plan( &self, job_id: &str, plan: &RecoveryPlan, ) -> Result<(), StateError>
Apply a recovery plan to resume job execution
Sourcepub async fn mark_items_processed(
&self,
job_id: &str,
item_ids: Vec<String>,
) -> Result<(), StateError>
pub async fn mark_items_processed( &self, job_id: &str, item_ids: Vec<String>, ) -> Result<(), StateError>
Mark items as processed during recovery
Sourcepub async fn mark_items_failed(
&self,
job_id: &str,
item_ids: Vec<String>,
) -> Result<(), StateError>
pub async fn mark_items_failed( &self, job_id: &str, item_ids: Vec<String>, ) -> Result<(), StateError>
Mark items as failed during recovery
Source§impl StateManager
impl StateManager
Sourcepub async fn transition_to_phase(
&self,
job_id: &str,
new_phase: PhaseType,
) -> Result<(), StateError>
pub async fn transition_to_phase( &self, job_id: &str, new_phase: PhaseType, ) -> Result<(), StateError>
Transition job to a new phase
Sourcepub async fn mark_job_started(&self, job_id: &str) -> Result<(), StateError>
pub async fn mark_job_started(&self, job_id: &str) -> Result<(), StateError>
Mark job as started (transition from Setup to Map)
Sourcepub async fn mark_reduce_started(&self, job_id: &str) -> Result<(), StateError>
pub async fn mark_reduce_started(&self, job_id: &str) -> Result<(), StateError>
Mark job as entering reduce phase
Sourcepub async fn mark_job_completed(&self, job_id: &str) -> Result<(), StateError>
pub async fn mark_job_completed(&self, job_id: &str) -> Result<(), StateError>
Mark job as completed
Sourcepub async fn mark_job_failed(
&self,
job_id: &str,
reason: String,
) -> Result<(), StateError>
pub async fn mark_job_failed( &self, job_id: &str, reason: String, ) -> Result<(), StateError>
Mark job as failed
Sourcepub async fn get_valid_transitions(
&self,
job_id: &str,
) -> Result<Vec<PhaseType>, StateError>
pub async fn get_valid_transitions( &self, job_id: &str, ) -> Result<Vec<PhaseType>, StateError>
Get valid next phases from current state
Sourcepub async fn can_transition(
&self,
job_id: &str,
to_phase: PhaseType,
) -> Result<bool, StateError>
pub async fn can_transition( &self, job_id: &str, to_phase: PhaseType, ) -> Result<bool, StateError>
Check if a specific transition is valid
Source§impl StateManager
impl StateManager
Sourcepub async fn create_job(
&self,
config: &MapReduceConfig,
job_id: String,
) -> Result<JobState, StateError>
pub async fn create_job( &self, config: &MapReduceConfig, job_id: String, ) -> Result<JobState, StateError>
Create a new job state
Sourcepub async fn update_state<F>(
&self,
job_id: &str,
updater: F,
) -> Result<JobState, StateError>
pub async fn update_state<F>( &self, job_id: &str, updater: F, ) -> Result<JobState, StateError>
Update job state with a closure
Sourcepub async fn get_state(
&self,
job_id: &str,
) -> Result<Option<JobState>, StateError>
pub async fn get_state( &self, job_id: &str, ) -> Result<Option<JobState>, StateError>
Get job state
Sourcepub async fn list_jobs(&self) -> Result<Vec<JobSummary>, StateError>
pub async fn list_jobs(&self) -> Result<Vec<JobSummary>, StateError>
List all jobs
Sourcepub async fn get_state_history(&self, job_id: &str) -> Vec<StateEvent>
pub async fn get_state_history(&self, job_id: &str) -> Vec<StateEvent>
Get state history for a job
Auto Trait Implementations§
impl !RefUnwindSafe for StateManager
impl !UnwindSafe for StateManager
impl Freeze for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl UnsafeUnpin for StateManager
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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