Documentation ¶
Index ¶
- type Config
- type Handler
- func (h *Handler) Close() error
- func (h *Handler) GetLSNParser() replication.LSNParser
- func (h *Handler) GetReplicationLag(ctx context.Context) (int64, error)
- func (h *Handler) ReceiveMessage(ctx context.Context) (*replication.Message, error)
- func (h *Handler) StartReplication(ctx context.Context) error
- func (h *Handler) SyncLSN(ctx context.Context, lsn replication.LSN) error
- type LSNParser
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles the postgres replication slot operations
func NewHandler ¶
NewHandler returns a new postgres replication handler for the database on input.
func (*Handler) GetLSNParser ¶
func (h *Handler) GetLSNParser() replication.LSNParser
GetLSNParser returns a postgres implementation of the LSN parser.
func (*Handler) GetReplicationLag ¶
GetReplicationLag will return the consumer current replication lag. This value is different from the postgres replication lag, which takes into consideration all consumers and ongoing transactions.
func (*Handler) ReceiveMessage ¶
ReceiveMessage will listen for messages from the WAL. It returns an error if an unexpected message is received.
func (*Handler) StartReplication ¶
StartReplication will start the replication process on the configured replication slot. It will check for the last synced LSN (confirmed_flush_lsn), and if there isn't one, it will start replication from the restart_lsn position.
type LSNParser ¶
type LSNParser struct{}
LSNParser is the postgres implementation of the replication.LSNParser
func NewLSNParser ¶
func NewLSNParser() *LSNParser
func (*LSNParser) FromString ¶
func (p *LSNParser) FromString(lsnStr string) (replication.LSN, error)