Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketAssigner ¶
type BucketAssigner interface {
AssignBuckets(ctx context.Context, table string, recordID string, operation synchro.Operation, data map[string]any) ([]string, error)
}
BucketAssigner resolves which buckets a changed record belongs to.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer reads from a PostgreSQL logical replication slot and writes changelog entries for each captured change.
func NewConsumer ¶
func NewConsumer(cfg ConsumerConfig) *Consumer
NewConsumer creates a new WAL consumer.
type ConsumerConfig ¶
type ConsumerConfig struct {
// ConnString is the PostgreSQL connection string with replication=database.
ConnString string
// SlotName is the replication slot name.
SlotName string
// PublicationName is the publication to subscribe to.
PublicationName string
// Registry is used to look up table configurations.
Registry *synchro.Registry
// Assigner determines bucket IDs for changed records.
Assigner BucketAssigner
// ChangelogDB writes entries to sync sidecar tables and persists WAL position.
ChangelogDB synchro.DB
// Logger for consumer events.
Logger *slog.Logger
// StandbyTimeout is how often to send standby status updates.
// Defaults to 10 seconds.
StandbyTimeout time.Duration
}
ConsumerConfig configures the WAL consumer.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes pgoutput protocol messages into WALEvents.
func NewDecoder ¶
NewDecoder creates a new WAL message decoder.
type Position ¶
type Position struct {
// contains filtered or unexported fields
}
Position tracks the confirmed LSN with persistent storage for crash recovery.
func NewPosition ¶
NewPosition creates a new Position tracker backed by persistent storage. On first call, loads the last confirmed LSN from sync_wal_position.
Click to show internal directories.
Click to hide internal directories.