userver: storages::postgres::NotifyScope Class Reference
Loading...
Searching...
No Matches
storages::postgres::NotifyScope Class Referencefinal

#include <userver/storages/postgres/notify.hpp>

Detailed Description

RAII scope for receiving notifications.

Used for waiting for notifications on PostgreSQL connections. Created by calling storages::postgres::Cluster::Listen(). Exclusively holds a connection from a pool.

Non-copyable.

Usage synopsis
auto scope = cluster.Listen("channel");
cluster.Execute(pg::ClusterHostType::kMaster,
"select pg_notify('channel', NULL)");
auto ntf = scope.WaitNotify(engine::Deadline::FromDuration(100ms));

Definition at line 37 of file notify.hpp.

Public Member Functions

 NotifyScope (detail::ConnectionPtr conn, std::string_view channel, OptionalCommandControl cmd_ctl)
 
 NotifyScope (NotifyScope &&) noexcept
 
NotifyScopeoperator= (NotifyScope &&) noexcept
 
 NotifyScope (const NotifyScope &)=delete
 
NotifyScopeoperator= (const NotifyScope &)=delete
 
Notification WaitNotify (engine::Deadline deadline)
 Wait for notification on connection.
 

The documentation for this class was generated from the following file: