Skip to main content

PassHooks

Trait PassHooks 

Source
pub trait PassHooks: Send + Sync {
    // Provided methods
    fn outbound(&self, _extras: &mut Extras) -> Vec<RawRecord> { ... }
    fn on_foreign_records(
        &self,
        _records: &[RawRecord],
        _extras: &mut Extras,
    ) -> Vec<RawRecord> { ... }
    fn on_account_switch(&self, _from: &str, _to: &str) { ... }
}
Expand description

Optional domain extension for record types the engine does not own (device announcements, request queues, …).

Provided Methods§

Source

fn outbound(&self, _extras: &mut Extras) -> Vec<RawRecord>

Records to write at the start of a pass (e.g. device announce). A failure to write them fails the pass.

Source

fn on_foreign_records( &self, _records: &[RawRecord], _extras: &mut Extras, ) -> Vec<RawRecord>

Records of other types seen in this pass’s delta. Returned records are written back; a failed write is reported and retried because the hook must be idempotent over the ledger extras.

Source

fn on_account_switch(&self, _from: &str, _to: &str)

The account scope changed. The engine resets its own ledger for the new scope (its extras start empty again); drop any app-owned state that belonged to from.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§