pub struct StateStore { /* private fields */ }Implementations§
Source§impl StateStore
impl StateStore
pub fn open(config_path: &str) -> Result<Self>
Sourcepub fn state_db_path(config_path: &str) -> PathBuf
pub fn state_db_path(config_path: &str) -> PathBuf
Path to .rivet_state.db next to the config file (same rules as open).
Sourcepub fn find_in_progress_chunk_run(
&self,
export_name: &str,
) -> Result<Option<(String, String)>>
pub fn find_in_progress_chunk_run( &self, export_name: &str, ) -> Result<Option<(String, String)>>
Latest in_progress chunk run for this export, if any.
pub fn create_chunk_run( &self, run_id: &str, export_name: &str, plan_hash: &str, max_chunk_attempts: u32, ) -> Result<()>
pub fn insert_chunk_tasks( &self, run_id: &str, ranges: &[(i64, i64)], ) -> Result<()>
Sourcepub fn reset_stale_running_chunk_tasks(&self, run_id: &str) -> Result<usize>
pub fn reset_stale_running_chunk_tasks(&self, run_id: &str) -> Result<usize>
Mark tasks left running after a crash as pending / failed retryable again.
Sourcepub fn claim_next_chunk_task(
&self,
run_id: &str,
) -> Result<Option<(i64, String, String)>>
pub fn claim_next_chunk_task( &self, run_id: &str, ) -> Result<Option<(i64, String, String)>>
Atomically claim the next pending or retryable failed chunk (single-threaded export).
Sourcepub fn claim_next_chunk_task_at_path(
db_path: &Path,
run_id: &str,
) -> Result<Option<(i64, String, String)>>
pub fn claim_next_chunk_task_at_path( db_path: &Path, run_id: &str, ) -> Result<Option<(i64, String, String)>>
Same as claim_next_chunk_task using a fresh connection (parallel workers).
pub fn complete_chunk_task( &self, run_id: &str, chunk_index: i64, rows_written: i64, file_name: Option<&str>, ) -> Result<()>
pub fn fail_chunk_task( &self, run_id: &str, chunk_index: i64, err: &str, ) -> Result<()>
pub fn fail_chunk_task_at_path( db_path: &Path, run_id: &str, chunk_index: i64, err: &str, ) -> Result<()>
pub fn complete_chunk_task_at_path( db_path: &Path, run_id: &str, chunk_index: i64, rows_written: i64, file_name: Option<&str>, ) -> Result<()>
pub fn count_chunk_tasks_not_completed(&self, run_id: &str) -> Result<i64>
pub fn finalize_chunk_run_completed(&self, run_id: &str) -> Result<()>
Sourcepub fn reset_chunk_checkpoint(&self, export_name: &str) -> Result<usize>
pub fn reset_chunk_checkpoint(&self, export_name: &str) -> Result<usize>
Remove all chunk runs and tasks for an export (abandon resume).
Sourcepub fn get_latest_chunk_run(
&self,
export_name: &str,
) -> Result<Option<(String, String, String, String)>>
pub fn get_latest_chunk_run( &self, export_name: &str, ) -> Result<Option<(String, String, String, String)>>
Latest chunk_run row for an export (any status), for rivet state chunks.
pub fn list_chunk_tasks_for_run( &self, run_id: &str, ) -> Result<Vec<ChunkTaskInfo>>
pub fn get(&self, export_name: &str) -> Result<CursorState>
pub fn update(&self, export_name: &str, cursor_value: &str) -> Result<()>
pub fn reset(&self, export_name: &str) -> Result<()>
pub fn list_all(&self) -> Result<Vec<CursorState>>
pub fn record_metric( &self, export_name: &str, run_id: &str, duration_ms: i64, total_rows: i64, peak_rss_mb: Option<i64>, status: &str, error_message: Option<&str>, tuning_profile: Option<&str>, format: Option<&str>, mode: Option<&str>, files_produced: i64, bytes_written: i64, retries: i64, validated: Option<bool>, schema_changed: Option<bool>, ) -> Result<()>
pub fn get_metrics( &self, export_name: Option<&str>, limit: usize, ) -> Result<Vec<ExportMetric>>
pub fn record_file( &self, run_id: &str, export_name: &str, file_name: &str, row_count: i64, bytes: i64, format: &str, compression: Option<&str>, ) -> Result<()>
pub fn get_files( &self, export_name: Option<&str>, limit: usize, ) -> Result<Vec<FileRecord>>
pub fn get_stored_schema( &self, export_name: &str, ) -> Result<Option<Vec<SchemaColumn>>>
pub fn store_schema( &self, export_name: &str, columns: &[SchemaColumn], ) -> Result<()>
pub fn detect_schema_change( &self, export_name: &str, current: &[SchemaColumn], ) -> Result<Option<SchemaChange>>
pub fn open_in_memory() -> Result<Self>
Auto Trait Implementations§
impl !Freeze for StateStore
impl !RefUnwindSafe for StateStore
impl Send for StateStore
impl !Sync for StateStore
impl Unpin for StateStore
impl UnsafeUnpin for StateStore
impl !UnwindSafe for StateStore
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
Mutably borrows from an owned value. Read more