pglogical

package
v0.0.0-...-9e054ec Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package pglogical contains support for reading a PostgreSQL logical replication feed.

Index

Constants

This section is empty.

Variables

Set is used by Wire.

Functions

This section is empty.

Types

type Config

type Config struct {
	DLQ       dlq.Config
	Script    script.Config
	Sequencer sequencer.Config
	Staging   sinkprod.StagingConfig
	Target    sinkprod.TargetConfig

	// The name of the publication to attach to.
	Publication string
	// The replication slot to attach to.
	Slot string
	// How ofter to report progress to the source database.
	StandbyTimeout time.Duration
	// Connection string for the source db.
	SourceConn string
	// The SQL schema in the target cluster to write into. This value is
	// optional if a userscript dispatch function is present.
	TargetSchema ident.Schema
	// Enable support for toasted columns
	ToastedColumns bool
}

Config contains the configuration necessary for creating a replication connection. All field, other than TestControls, are mandatory unless explicitly indicated.

func (*Config) Bind

func (c *Config) Bind(f *pflag.FlagSet)

Bind adds flags to the set.

func (*Config) Preflight

func (c *Config) Preflight() error

Preflight updates the configuration with sane defaults or returns an error if there are missing options for which a default cannot be provided.

type Conn

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

A Conn encapsulates all wire-connection behavior. It is responsible for receiving replication messages and replying with status updates.

func ProvideConn

func ProvideConn(
	ctx *stopper.Context,
	acc *apply.Acceptor,
	chaos *chaos.Chaos,
	config *Config,
	imm *immediate.Immediate,
	memo types.Memo,
	scriptSeq *script.Sequencer,
	stagingPool *types.StagingPool,
	targetPool *types.TargetPool,
	watchers types.Watchers,
) (*Conn, error)

ProvideConn is called by Wire to construct a connection to the source database. This provider will perform some pre-flight tests on the source database to ensure that replication has been configured. There's a fake dependency on the script loader so that flags can be evaluated first.

func (*Conn) Start

func (c *Conn) Start(ctx *stopper.Context) error

Start launches goroutines into the context.

type EagerConfig

type EagerConfig Config

EagerConfig is a hack to get Wire to move userscript evaluation to the beginning of the injector. This allows CLI flags to be set by the script.

func ProvideEagerConfig

func ProvideEagerConfig(cfg *Config, _ *scriptRT.Loader) (*EagerConfig, error)

ProvideEagerConfig is a hack to move up the evaluation of the user script so that the options callbacks can set any non-script-related CLI flags. The configuration will be preflighted.

type PGLogical

type PGLogical struct {
	Conn        *Conn
	Diagnostics *diag.Diagnostics
	Memo        types.Memo // Support testing.
}

PGLogical is a PostgreSQL logical replication loop.

func Start

func Start(context *stopper.Context, config *Config) (*PGLogical, error)

Start creates a PostgreSQL logical replication loop using the provided configuration.

func (*PGLogical) GetDiagnostics

func (l *PGLogical) GetDiagnostics() *diag.Diagnostics

GetDiagnostics implements stdlogical.HasDiagnostics.

Jump to

Keyboard shortcuts

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