patroni

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ApiPort = 8008
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterMember added in v1.8.0

type ClusterMember struct {
	Name     string         `json:"name"`
	Role     string         `json:"role"`
	State    string         `json:"state"`
	Timeline int            `json:"timeline"`
	Lag      ReplicationLag `json:"lag,omitempty"`
}

ClusterMember cluster member data from Patroni API

type ClusterMembers added in v1.8.0

type ClusterMembers struct {
	Members []ClusterMember `json:"members"`
}

ClusterMembers array of cluster members from Patroni API

type Interface

type Interface interface {
	GetClusterMembers(master *v1.Pod) ([]ClusterMember, error)
	Switchover(master *v1.Pod, candidate string) error
	SetPostgresParameters(server *v1.Pod, options map[string]string) error
	SetStandbyClusterParameters(server *v1.Pod, options map[string]interface{}) error
	GetMemberData(server *v1.Pod) (MemberData, error)
	Restart(server *v1.Pod) error
	GetConfig(server *v1.Pod) (acidv1.Patroni, map[string]string, error)
	SetConfig(server *v1.Pod, config map[string]interface{}) error
}

Interface describe patroni methods

type MemberData added in v1.6.2

type MemberData struct {
	State           string            `json:"state"`
	Role            string            `json:"role"`
	ServerVersion   int               `json:"server_version"`
	PendingRestart  bool              `json:"pending_restart"`
	ClusterUnlocked bool              `json:"cluster_unlocked"`
	Patroni         MemberDataPatroni `json:"patroni"`
}

MemberData Patroni member data from Patroni API

type MemberDataPatroni added in v1.6.2

type MemberDataPatroni struct {
	Version string `json:"version"`
	Scope   string `json:"scope"`
}

MemberDataPatroni child element

type Patroni

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

Patroni API client

func New

func New(logger *logrus.Entry, client httpclient.HTTPClient) *Patroni

New create patroni

func (*Patroni) GetClusterMembers added in v1.8.0

func (p *Patroni) GetClusterMembers(server *v1.Pod) ([]ClusterMember, error)

GetClusterMembers read cluster data from patroni API

func (*Patroni) GetConfig added in v1.7.0

func (p *Patroni) GetConfig(server *v1.Pod) (acidv1.Patroni, map[string]string, error)

func (*Patroni) GetMemberData added in v1.6.2

func (p *Patroni) GetMemberData(server *v1.Pod) (MemberData, error)

GetMemberData read member data from patroni API

func (*Patroni) Restart added in v1.7.0

func (p *Patroni) Restart(server *v1.Pod) error

Restart method restarts instance via Patroni POST API call.

func (*Patroni) SetConfig added in v1.7.0

func (p *Patroni) SetConfig(server *v1.Pod, config map[string]interface{}) error

SetConfig sets Patroni options via Patroni patch API call.

func (*Patroni) SetPostgresParameters

func (p *Patroni) SetPostgresParameters(server *v1.Pod, parameters map[string]string) error

SetPostgresParameters sets Postgres options via Patroni patch API call.

func (*Patroni) SetStandbyClusterParameters added in v1.11.0

func (p *Patroni) SetStandbyClusterParameters(server *v1.Pod, parameters map[string]interface{}) error

SetStandbyClusterParameters sets StandbyCluster options via Patroni patch API call.

func (*Patroni) Switchover

func (p *Patroni) Switchover(master *v1.Pod, candidate string) error

Switchover by calling Patroni REST API

type ReplicationLag added in v1.8.1

type ReplicationLag uint64

func (*ReplicationLag) UnmarshalJSON added in v1.8.1

func (rl *ReplicationLag) UnmarshalJSON(data []byte) error

UnmarshalJSON converts member lag (can be int or string) into uint64

Jump to

Keyboard shortcuts

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