![]() |
MantisBase v0.4.9
|
#include <realtime.h>


Public Member Functions | |
| MbRealtimeDB (const MantisBase &app) | |
| ~MbRealtimeDB () | |
| bool | init () const |
| void | addDbHooks (const std::string &entity_name) const |
| void | addDbHooks (const MbEntity &entity) const |
| void | dropDbHooks (const std::string &entity_name) const |
| void | runWorker (const RtCallback &callback) |
| void | stopWorker () const |
| void | notifyChange () const |
| Public Member Functions inherited from mb::MbAppMixin | |
| MbAppMixin (const MantisBase &app) | |
| Constrictor for instantiating this interface. | |
| MbAppMixin (MbAppMixin &&)=default | |
| MbAppMixin & | operator= (MbAppMixin &&)=delete |
| MbAppMixin (const MbAppMixin &)=default | |
| MbAppMixin & | operator= (const MbAppMixin &)=delete |
| const MantisBase & | mbApp () const |
| Application that owns this service or request context. | |
| const MbLogger & | logger () const |
Static Public Member Functions | |
| static void | addDbHooks (const MbEntity &entity, const std::shared_ptr< soci::session > &sess) |
| static void | dropDbHooks (const std::string &entity_name, const std::shared_ptr< soci::session > &sess) |
Realtime database change detection and notification. Initializes DB-specific hooks (triggers for PostgreSQL, polling for SQLite) and runs a worker that invokes the registered callback with change events.
|
explicit |
| app | Owning application (used for db access/config). Stored by reference. |
|
default |
Defined in the library. The implicit destructor would be emitted in every consumer and would need MbRtDbWorker, which is not exported.
| void mb::MbRealtimeDB::addDbHooks | ( | const MbEntity & | entity | ) | const |
Register change hooks for an entity.
|
static |
Register change hooks for an entity on a given session (static, for schema creation).
| void mb::MbRealtimeDB::addDbHooks | ( | const std::string & | entity_name | ) | const |
Register change hooks for an entity by name.
| void mb::MbRealtimeDB::dropDbHooks | ( | const std::string & | entity_name | ) | const |
Remove change hooks for an entity by name.
|
static |
Remove change hooks for an entity on a given session (static).
|
nodiscard |
Initialize realtime for the current database backend. Must be called after DB is ready.
| void mb::MbRealtimeDB::notifyChange | ( | ) | const |
Wake the worker to drain change events immediately (push, not poll). Called by the write path after a mutation commits. No-op if the worker is not running. Thread-safe.
| void mb::MbRealtimeDB::runWorker | ( | const RtCallback & | callback | ) |
Start the realtime worker; callback receives change events.
| void mb::MbRealtimeDB::stopWorker | ( | ) | const |
Stop the realtime worker.