slot

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSlotNotExists = errors.New("slot does not exist")
	ErrNotConnected  = errors.New("slot is not connected")
	ErrSlotClosed    = errors.New("slot is closed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Name                        string
	SlotActivityCheckerInterval time.Duration
	CreateIfNotExists           bool
}

func NewConfig

func NewConfig(opts ...Option) Config

func (Config) Validate

func (c Config) Validate() error

type Info

type Info struct {
	Name              string `json:"name"`
	Type              Type   `json:"type"`
	WalStatus         string `json:"walStatus"`
	RestartLSN        pg.LSN `json:"restartLSN"`
	ConfirmedFlushLSN pg.LSN `json:"confirmedFlushLSN"`
	CurrentLSN        pg.LSN `json:"currentLSN"`
	RetainedWALSize   pg.LSN `json:"retainedWALSize"`
	Lag               pg.LSN `json:"lag"`
	ActivePID         int32  `json:"activePID"`
	Active            bool   `json:"active"`
}

type Option

type Option func(*Config)

func WithCreateIfNotExists

func WithCreateIfNotExists(createIfNotExists bool) Option

func WithName

func WithName(name string) Option

func WithSlotActivityCheckerInterval

func WithSlotActivityCheckerInterval(interval time.Duration) Option

type Slot

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

func NewSlot

func NewSlot(replicationDSN, standardDSN string, cfg Config, updater XLogUpdater) *Slot

func (*Slot) Close

func (s *Slot) Close(ctx context.Context)

func (*Slot) Connect

func (s *Slot) Connect(ctx context.Context) error

func (*Slot) Create

func (s *Slot) Create(ctx context.Context) (*Info, error)

func (*Slot) Info

func (s *Slot) Info(ctx context.Context) (*Info, error)

type Type

type Type string
const (
	Logical  Type = "logical"
	Physical Type = "physical"
)

type XLogUpdater

type XLogUpdater interface {
	UpdateXLogPos(l pg.LSN)
}

Jump to

Keyboard shortcuts

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