Skip to main content

StatePublisher

Trait StatePublisher 

Source
pub trait StatePublisher: Send + Sync {
    // Required methods
    fn on_record(&self, table: &str, record_id: &str, encrypted: &[u8]);
    fn on_delete(&self, table: &str, record_id: &str);
}
Expand description

Sink for vault-state changes so a node can replicate its redb records to a standby (the keep-state-over-wisp design). keep-web installs an implementation that publishes each change as a Nostr event; keep-core only signals table/record/bytes and never touches the network. on_record carries the record’s already-encrypted redb bytes – the exact bytes stored – so a peer that shares the vault key stores them verbatim. Called from inside the write path, so an implementation MUST NOT block: enqueue and return.

Required Methods§

Source

fn on_record(&self, table: &str, record_id: &str, encrypted: &[u8])

A record was written: table is one of keys/descriptors/relay_configs, record_id is its hex redb key, and encrypted is the vault-encrypted bytes as stored.

Source

fn on_delete(&self, table: &str, record_id: &str)

A record (table, hex record_id) was deleted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§