replication

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSlotName = "lode_main"
View Source
const StandbyStatusInterval = 10 * time.Second

Variables

This section is empty.

Functions

func StreamChanges

func StreamChanges(
	logger *logrus.Logger,
	ctx context.Context,
	replConn *pgx.ReplicationConn,
	slotName string,
	state *State,
	onMessage func(*parser.Wal2JsonMessage) error,
) error

Starts streaming changes on given replication slot using replication connection Takes in cancellable context that will stop the streaming process when cancelled Takes in onMessage handler function that will process WalMessages received by the streaming process and optionally return an error to stop streaming when an unexpected event happens

Types

type State

type State struct {
	CurrentLSN uint64
}

func Setup

func Setup(logger *logrus.Logger, pgConn *pgx.Conn, replConn *pgx.ReplicationConn, slotNameOverride string) (string, *State, error)

type WALPayload

type WALPayload struct {
	NextLSN string `json:"nextlsn"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL