sos_protocol

Trait RemoteSyncHandler

Source
pub trait RemoteSyncHandler {
    type Client: SyncClient + Send + Sync + 'static;
    type Account: Account + SyncStorage + Merge + ForceMerge + Send + Sync + 'static;
    type Error: Error + Debug + AsConflict + From<ConflictError> + From<Error> + From<Error> + From<<Self::Account as Account>::Error> + From<<Self::Client as SyncClient>::Error> + Send + Sync + 'static;

    // Required methods
    fn client(&self) -> &Self::Client;
    fn origin(&self) -> &Origin;
    fn address(&self) -> &Address;
    fn account(&self) -> Arc<Mutex<Self::Account>>;
    fn direction(&self) -> SyncDirection;
    fn file_transfer_queue(&self) -> &FileTransferQueueSender;
    fn execute_sync_file_transfers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn create_account<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn sync_account<'life0, 'async_trait>(
        &'life0 self,
        remote_status: SyncStatus,
    ) -> Pin<Box<dyn Future<Output = Result<MergeOutcome, Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for types that bridge between a remote data source and a local account.

Required Associated Types§

Source

type Client: SyncClient + Send + Sync + 'static

Client used to fetch data from the data source.

Source

type Account: Account + SyncStorage + Merge + ForceMerge + Send + Sync + 'static

Local account.

Source

type Error: Error + Debug + AsConflict + From<ConflictError> + From<Error> + From<Error> + From<<Self::Account as Account>::Error> + From<<Self::Client as SyncClient>::Error> + Send + Sync + 'static

Error implementation.

Required Methods§

Source

fn client(&self) -> &Self::Client

Client implementation.

Source

fn origin(&self) -> &Origin

Remote origin.

Source

fn address(&self) -> &Address

Account address.

Source

fn account(&self) -> Arc<Mutex<Self::Account>>

Local account.

Source

fn direction(&self) -> SyncDirection

Direction for account creation and auto merge.

Source

fn file_transfer_queue(&self) -> &FileTransferQueueSender

Available on crate feature files only.

Queue for file transfers.

Source

fn execute_sync_file_transfers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Available on crate feature files only.

Sync file transfers.

Provided Methods§

Source

fn create_account<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Create an account on local or remote depending on the sync direction.

Source

fn sync_account<'life0, 'async_trait>( &'life0 self, remote_status: SyncStatus, ) -> Pin<Box<dyn Future<Output = Result<MergeOutcome, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sync the account.

Implementors§

Source§

impl RemoteSyncHandler for LinkedAccount

Available on crate feature integration only.