replicate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	DatabaseURL           string        `env:"REPLICATE_DATABASE_URL" envDefault:"postgresql://127.0.0.1/postgres?replication=database"`
	StandbyMessageTimeout time.Duration `env:"REPLICATE_STANDBY_MESSAGE_TIMEOUT" envDefault:"10s"`
}

Conf configures the package components

func ParseConfig

func ParseConfig() (cfg Conf, err error)

ParseConfig parses the env variables into our config

type Delegate

type Delegate interface {
	HandleChange(m pglogrepl.Message) error
}

Delegate get's called to handle a change message. HandleChange should not block since it will slow down the message replication thread.

type DelegateFunc

type DelegateFunc func(m pglogrepl.Message) error

DelegateFunc implements Delegate

func (DelegateFunc) HandleChange

func (f DelegateFunc) HandleChange(m pglogrepl.Message) error

HandleChange allos the func to handle any changes

type PublicationName

type PublicationName string

PublicationName describes the name of the publication

var TemporaryPublication PublicationName = ""

TemporaryPublication is a publication name that is generated

type Replicate

type Replicate struct {
	// contains filtered or unexported fields
}

Replicate allows for logical replication

func New

func New(lc fx.Lifecycle, logs *zap.Logger, cfg Conf, sn SlotName, pn PublicationName, del Delegate) (r *Replicate)

New inits the logical replication

func (*Replicate) Start

func (r *Replicate) Start(ctx context.Context) (err error)

Start the logical replication

func (*Replicate) Stop

func (r *Replicate) Stop(ctx context.Context) (err error)

Stop will stop by waiting for the message handling to top

type SlotName

type SlotName string

SlotName configures the slot to use

var TemporarySlot SlotName = ""

TemporarySlot can be used to indicate that a slot name should generated

Jump to

Keyboard shortcuts

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