[][src]Trait sync15::clients::CommandProcessor

pub trait CommandProcessor {
    fn settings(&self) -> &Settings;
fn fetch_outgoing_commands(&self) -> Result<HashSet<Command>>;
fn apply_incoming_command(&self, command: Command) -> Result<CommandStatus>; }

A command processor applies incoming commands like wipes and resets for all stores, and returns commands to send to other clients. It also manages settings like the device name and type, which is stored in the special clients collection.

In practice, this trait only has one implementation, in the sync manager. It's split this way because the clients engine depends on internal sync15 structures, and can't be implemented as a syncable store...but sync15 doesn't know anything about multiple engines. This lets the sync manager provide its own implementation for handling wipe and reset commands for all the engines that it manages.

Required methods

fn settings(&self) -> &Settings

fn fetch_outgoing_commands(&self) -> Result<HashSet<Command>>

Fetches commands to send to other clients. An error return value means commands couldn't be fetched, and halts the sync.

fn apply_incoming_command(&self, command: Command) -> Result<CommandStatus>

Applies a command sent to this client from another client. This method should return a CommandStatus indicating whether the command was processed.

An error return value means the sync manager encountered an error applying the command, and halts the sync to prevent unexpected behavior (for example, merging local and remote bookmarks, when we were told to wipe our local bookmarks).

Loading content...

Implementors

Loading content...