postgres

package
v0.7.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort = 5432
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func NewConfig

func NewConfig(properties map[string]string) (*Config, error)

func (*Config) GetConnectURLWithHost

func (config *Config) GetConnectURLWithHost(host string) string

func (*Config) GetDBPort

func (config *Config) GetDBPort() int

func (*Config) GetOtherConnectionWithHost

func (config *Config) GetOtherConnectionWithHost(ctx context.Context, host string) (*pgx.Conn, error)

type Manager

type Manager struct {
	component.DBManagerBase
	Pool *pgxpool.Pool
	Proc *process.Process
}
var Mgr *Manager

func NewManager

func NewManager(logger logger.Logger) (*Manager, error)

func (*Manager) CreateRoot

func (mgr *Manager) CreateRoot(ctx context.Context) error

func (*Manager) Demote

func (mgr *Manager) Demote(context.Context) error

func (*Manager) Exec

func (mgr *Manager) Exec(ctx context.Context, sql string) (result int64, err error)

func (*Manager) Follow

func (mgr *Manager) Follow(ctx context.Context, cluster *dcs.Cluster) error

func (*Manager) GetHealthiestMember

func (mgr *Manager) GetHealthiestMember(cluster *dcs.Cluster, candidate string) *dcs.Member

func (*Manager) GetMemberAddrs

func (mgr *Manager) GetMemberAddrs(ctx context.Context, cluster *dcs.Cluster) []string

func (*Manager) GetMemberStateWithPool

func (mgr *Manager) GetMemberStateWithPool(ctx context.Context, pool *pgxpool.Pool) (string, error)

func (*Manager) GetOtherPoolsWithHosts

func (mgr *Manager) GetOtherPoolsWithHosts(ctx context.Context, hosts []string) ([]*pgxpool.Pool, error)

func (*Manager) HasOtherHealthyLeader

func (mgr *Manager) HasOtherHealthyLeader(ctx context.Context, cluster *dcs.Cluster) *dcs.Member

func (*Manager) HasOtherHealthyMembers

func (mgr *Manager) HasOtherHealthyMembers(ctx context.Context, cluster *dcs.Cluster, leader string) []*dcs.Member

func (*Manager) InitializeCluster

func (mgr *Manager) InitializeCluster(context.Context, *dcs.Cluster) error

func (*Manager) IsClusterHealthy

func (mgr *Manager) IsClusterHealthy(ctx context.Context, cluster *dcs.Cluster) bool

func (*Manager) IsClusterInitialized

func (mgr *Manager) IsClusterInitialized(ctx context.Context, cluster *dcs.Cluster) (bool, error)

func (*Manager) IsCurrentMemberHealthy

func (mgr *Manager) IsCurrentMemberHealthy(ctx context.Context, cluster *dcs.Cluster) bool

func (*Manager) IsCurrentMemberInCluster

func (mgr *Manager) IsCurrentMemberInCluster(ctx context.Context, cluster *dcs.Cluster) bool

func (*Manager) IsDBStartupReady

func (mgr *Manager) IsDBStartupReady() bool

func (*Manager) IsLeader

func (mgr *Manager) IsLeader(ctx context.Context, cluster *dcs.Cluster) (bool, error)

func (*Manager) IsLeaderMember

func (mgr *Manager) IsLeaderMember(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)

func (*Manager) IsLeaderWithPool

func (mgr *Manager) IsLeaderWithPool(ctx context.Context, pool *pgxpool.Pool) (bool, error)

func (*Manager) IsMemberHealthy

func (mgr *Manager) IsMemberHealthy(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) bool

func (*Manager) IsRootCreated

func (mgr *Manager) IsRootCreated(ctx context.Context) (bool, error)

func (*Manager) IsRunning

func (mgr *Manager) IsRunning() bool

func (*Manager) JoinCurrentMemberToCluster

func (mgr *Manager) JoinCurrentMemberToCluster(ctx context.Context, cluster *dcs.Cluster) error

JoinCurrentMemberToCluster postgresql don't need to add member

func (*Manager) LeaveMemberFromCluster

func (mgr *Manager) LeaveMemberFromCluster(context.Context, *dcs.Cluster, string) error

LeaveMemberFromCluster postgresql don't need to delete member

func (*Manager) Lock

func (mgr *Manager) Lock(ctx context.Context, reason string) error

func (*Manager) Promote

func (mgr *Manager) Promote(ctx context.Context, cluster *dcs.Cluster) error

func (*Manager) Query

func (mgr *Manager) Query(ctx context.Context, sql string) (result []byte, err error)

func (*Manager) QueryWithPool

func (mgr *Manager) QueryWithPool(ctx context.Context, sql string, pool *pgxpool.Pool) (result []byte, err error)

func (*Manager) Recover

func (mgr *Manager) Recover(context.Context) error

func (*Manager) ShutDownWithWait

func (mgr *Manager) ShutDownWithWait()

func (*Manager) Stop

func (mgr *Manager) Stop() error

func (*Manager) Unlock

func (mgr *Manager) Unlock(ctx context.Context) error

type PGStandby

type PGStandby struct {
	Types   string
	Amount  int
	Members mapset.Set
	HasStar bool
}

type PidFile

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

Jump to

Keyboard shortcuts

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