Expand description
Postgres LISTEN/NOTIFY transport for the themis_sync::Hub.
See the repository README for the full guide.
use themis_sync::Hub;
use themis_postgres::PgTransport;
let hub = Hub::builder()
.transport(PgTransport::new("postgres://app@localhost/app", "themis_changes")?)
.build();
let _relay = hub.spawn_relay();§Notifying in the same transaction as the change
NOTIFY is delivered only on commit. Writing the grant and calling notify in the same
transaction guarantees that the notice goes out if, and only if, the change was written. A notice
sent this way does not go through themis_sync::Hub::publish and arrives without an origin, so
the relay delivers it on every instance, including the one that wrote it.
TLS: PgTransport::with_tls accepts any tokio-postgres connector
(postgres-native-tls, tokio-postgres-rustls).
Structs§
Constants§
- MAX_
PAYLOAD - Largest payload
pg_notifyaccepts with the default Postgres configuration.
Functions§
- notify
- Sends
changeon the channel through the given client or transaction.