Documentation
¶
Overview ¶
Package changepub publishes write-change events on the IPC PUB socket after every successful DB write on the primary instance, allowing secondaries to invalidate caches and refresh views without polling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MethodToTopic ¶
MethodToTopic maps a db.write method name to the corresponding PUB topic. Returns an empty string for methods that do not warrant a change event (e.g. read-only helpers or internal bookkeeping that secondaries need not see).
Types ¶
type BusPublisher ¶
type BusPublisher struct {
// contains filtered or unexported fields
}
BusPublisher publishes write-change events through an ipc.Bus.
func NewBusPublisher ¶
func NewBusPublisher(publishFn PublishFunc, instanceID, path string) *BusPublisher
NewBusPublisher creates a BusPublisher that wraps the given bus publish function.
type NoopPublisher ¶
type NoopPublisher struct{}
NoopPublisher discards all events — used when no bus is available.
type PublishFunc ¶
PublishFunc is the signature of the bus publish function.
type WriteChange ¶
type WriteChange struct {
InstanceID string `json:"instance_id"`
Path string `json:"path"`
Topic string `json:"topic"`
Payload json.RawMessage `json:"payload"`
Timestamp string `json:"timestamp"` // RFC3339
}
WriteChange is the standard envelope for write-change events.