pub trait SyncProvider<L>:
Send
+ Sync
+ Debugwhere
L: BucketLogProvider + Clone + Send + Sync + 'static,
L::Error: Error + Send + Sync + 'static,{
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 Peer<L>,
job: SyncJob,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for sync provider implementations
This trait abstracts WHEN and WHERE sync jobs are executed. The actual sync logic lives in the per-job modules. Implementations decide the execution context:
- Synchronous: Execute immediately by calling execute_job directly
- Queued: Send to a channel for background worker processing
- Actor-based: Send to an actor mailbox for processing
This allows minimal peers to use simple synchronous execution, while complex applications can decouple sync jobs from protocol handlers using queues.
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 Peer<L>,
job: SyncJob,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 Peer<L>,
job: SyncJob,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a sync job with the given peer
Implementations decide when and where this runs. The job execution logic is provided by the execute_job helper and per-job modules.