pub trait SyncOperationRepository:
Send
+ Sync
+ 'static {
// Required methods
fn create_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
dataset_ids: &'life2 [Uuid],
dataset_names: &'life3 [String],
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn mark_started<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn mark_completed<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
records_uploaded: i32,
records_downloaded: i32,
bytes_uploaded: i64,
bytes_downloaded: i64,
dataset_sync_hashes: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn mark_failed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
error_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn update_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
percent: u32,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn running_for_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_by_run_id<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Persistence trait for the cloud sync router.
Required Methods§
Sourcefn create_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
dataset_ids: &'life2 [Uuid],
dataset_names: &'life3 [String],
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn create_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
dataset_ids: &'life2 [Uuid],
dataset_names: &'life3 [String],
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Insert a new row in started state with progress = 0%.
Sourcefn mark_started<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn mark_started<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Transition a row to in_progress, setting started_at = NOW().
Sourcefn mark_completed<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
records_uploaded: i32,
records_downloaded: i32,
bytes_uploaded: i64,
bytes_downloaded: i64,
dataset_sync_hashes: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn mark_completed<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
records_uploaded: i32,
records_downloaded: i32,
bytes_uploaded: i64,
bytes_downloaded: i64,
dataset_sync_hashes: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Transition a row to completed, set completed_at = NOW(),
progress = 100. Optional totals get persisted alongside.
Sourcefn mark_failed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
error_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn mark_failed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
error_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Transition a row to failed, set completed_at = NOW(), copy the
error message into error_message.
Sourcefn update_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
percent: u32,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
percent: u32,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Update progress only (for the background task’s tick callback).
Sourcefn running_for_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn running_for_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
All rows for user_id with status in ('started', 'in_progress'),
ordered DESC by created_at.
Sourcefn get_by_run_id<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_by_run_id<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SyncOperationRow>, DatabaseError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Look up one row by its run_id.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".