feat(11-03): broadcast model writes through River jobs enqueued in the write transaction
- Broadcastable contract and Bind[T] bindings; event {action}.{alias},
default {model, actor, timestamp, ttl} payload, delete snapshot taken
before the row goes
- GORM callbacks installed via lagoon.OnDatabase enqueue a summer.broadcast
job on the write's *sql.Tx inside a savepoint; failures are logged and
never abort the write; zero-key batch writes are skipped
- WithoutBroadcasting[T] (ctx-scoped, per type) and Service.Emit for one
summary event; the one-attempt job namespaces channels and publishes or
broadcasts; the payload travels as a JSON string so JSONB keeps its order
- no jobs for the null driver or Centrifugo without an API key
This commit is contained in:
@@ -50,6 +50,10 @@ func NewDriver(svc *lighthouse.Service, cfg Config, hc *http.Client) *Driver {
|
||||
// Name returns "centrifugo".
|
||||
func (d *Driver) Name() string { return DriverName }
|
||||
|
||||
// Enabled reports whether publishing is configured (an API key is set).
|
||||
// Without it lighthouse enqueues no broadcast jobs.
|
||||
func (d *Driver) Enabled() bool { return d.client.Enabled() }
|
||||
|
||||
// Config returns the driver's configuration.
|
||||
func (d *Driver) Config() Config { return d.cfg }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user