infrastructure

package
v1.23.1 Latest Latest
Warning

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

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

Documentation

Overview

Package infrastructure contains the structs and interfaces needed to manage replication slots

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// List the available replication slots
	List(ctx context.Context, config *apiv1.ReplicationSlotsConfiguration) (ReplicationSlotList, error)
	// Update the replication slot
	Update(ctx context.Context, slot ReplicationSlot) error
	// Create the replication slot
	Create(ctx context.Context, slot ReplicationSlot) error
	// Delete the replication slot
	Delete(ctx context.Context, slot ReplicationSlot) error
}

Manager abstracts the operations that need to be sent to the database instance for the management of Replication Slots

func NewPostgresManager

func NewPostgresManager(pool pool.Pooler) Manager

NewPostgresManager returns an implementation of Manager for postgres

type PostgresManager

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

PostgresManager is a Manager for a database instance

func (PostgresManager) Create

func (sm PostgresManager) Create(ctx context.Context, slot ReplicationSlot) error

Create the replication slot

func (PostgresManager) Delete

func (sm PostgresManager) Delete(ctx context.Context, slot ReplicationSlot) error

Delete the replication slot

func (PostgresManager) List

List the available replication slots

func (PostgresManager) String

func (sm PostgresManager) String() string

func (PostgresManager) Update

func (sm PostgresManager) Update(ctx context.Context, slot ReplicationSlot) error

Update the replication slot

type ReplicationSlot

type ReplicationSlot struct {
	SlotName   string   `json:"slotName,omitempty"`
	Type       SlotType `json:"type,omitempty"`
	Active     bool     `json:"active"`
	RestartLSN string   `json:"restartLSN,omitempty"`
	IsHA       bool     `json:"isHA,omitempty"`
}

ReplicationSlot represents a single replication slot

type ReplicationSlotList

type ReplicationSlotList struct {
	Items []ReplicationSlot
}

ReplicationSlotList contains a list of replication slots

func (ReplicationSlotList) Get

Get returns the ReplicationSlot with the required name if present in the ReplicationSlotList

func (ReplicationSlotList) Has

func (sl ReplicationSlotList) Has(name string) bool

Has returns true is a ReplicationSlot with the required name if present in the ReplicationSlotList

type SlotType

type SlotType string

SlotType represents the type of replication slot

const SlotTypePhysical SlotType = "physical"

SlotTypePhysical represents the physical replication slot

Jump to

Keyboard shortcuts

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