pgflonats

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package pgflonats provides NATS integration for PostgreSQL replication state management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NATSClient

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

NATSClient represents a client for interacting with NATS

func NewNATSClient

func NewNATSClient(url, stream, group string) (*NATSClient, error)

NewNATSClient creates a new NATS client with the specified configuration, setting up the connection, main stream, and state bucket.

func (*NATSClient) Close

func (nc *NATSClient) Close() error

Close closes the NATS connection.

func (*NATSClient) GetState

func (nc *NATSClient) GetState() (State, error)

GetState retrieves the last saved state from NATS, initializing a new state if none is found.

func (*NATSClient) JetStream

func (nc *NATSClient) JetStream() nats.JetStreamContext

JetStream returns the JetStream context.

func (*NATSClient) PublishMessage

func (nc *NATSClient) PublishMessage(subject string, data []byte) error

PublishMessage publishes a message to the specified NATS subject.

func (*NATSClient) SaveState

func (nc *NATSClient) SaveState(state State) error

SaveState saves the current replication state to NATS.

type State

type State struct {
	LSN              pglogrepl.LSN `json:"lsn"`
	LastProcessedSeq map[string]uint64
}

State represents the current state of the replication process

Jump to

Keyboard shortcuts

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