Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidReplSlotName(name string) bool
- func IsWalFileName(name string) bool
- func PGLsnToInt(lsn string) (uint64, error)
- func ParseBinaryVersion(v string) (int, int, error)
- func ParseVersion(v string) (int, int, error)
- func SetLogger(l *zap.SugaredLogger)
- func WalFileNameNoTimeLine(name string) (string, error)
- func XlogPosToWalFileNameNoTimeline(XLogPos uint64) string
- type ConnParams
- type InitConfig
- type Manager
- func (p *Manager) BinaryVersion() (int, int, error)
- func (p *Manager) CreateReplicationSlot(name string) error
- func (p *Manager) CurHba() []string
- func (p *Manager) CurParameters() common.Parameters
- func (p *Manager) CurRecoveryOptions() *RecoveryOptions
- func (p *Manager) DropReplicationSlot(name string) error
- func (p *Manager) GetConfigFilePGParameters() (common.Parameters, error)
- func (p *Manager) GetReplicationSlots() ([]string, error)
- func (p *Manager) GetRole() (common.Role, error)
- func (p *Manager) GetSyncStandbys() ([]string, error)
- func (p *Manager) GetSystemData() (*SystemData, error)
- func (p *Manager) GetSystemdID() (string, error)
- func (p *Manager) GetTimelinesHistory(timeline uint64) ([]*TimelineHistory, error)
- func (p *Manager) Init(initConfig *InitConfig) error
- func (p *Manager) IsInitialized() (bool, error)
- func (p *Manager) IsRestartRequired(changedParams []string) (bool, error)
- func (p *Manager) IsStarted() (bool, error)
- func (p *Manager) OlderWalFile() (string, error)
- func (p *Manager) PGDataVersion() (int, int, error)
- func (p *Manager) Ping() error
- func (p *Manager) Promote() error
- func (p *Manager) Reload() error
- func (p *Manager) RemoveAll() error
- func (p *Manager) Restart(fast bool) error
- func (p *Manager) Restore(command string) error
- func (p *Manager) SetHba(hba []string)
- func (p *Manager) SetParameters(parameters common.Parameters)
- func (p *Manager) SetRecoveryOptions(recoveryOptions *RecoveryOptions)
- func (p *Manager) SetupRoles() error
- func (p *Manager) Start() error
- func (p *Manager) StartTmpMerged() error
- func (p *Manager) Stop(fast bool) error
- func (p *Manager) StopIfStarted(fast bool) error
- func (p *Manager) SyncFromFollowed(followedConnParams ConnParams, replSlot string) error
- func (p *Manager) SyncFromFollowedPGRewind(followedConnParams ConnParams, password string) error
- func (p *Manager) UpdateCurHba()
- func (p *Manager) UpdateCurParameters()
- func (p *Manager) UpdateCurRecoveryOptions()
- func (p *Manager) WaitReady(timeout time.Duration) error
- func (p *Manager) WaitRecoveryDone(timeout time.Duration) error
- type PGManager
- type RecoveryMode
- type RecoveryOptions
- type SystemData
- type TimelineHistory
Constants ¶
const ( // TODO(sgotti) for now we assume wal size is the default 16MiB size WalSegSize = (16 * 1024 * 1024) // 16MiB )
Variables ¶
var (
ErrUnknownState = errors.New("unknown postgres state")
)
var (
ValidReplSlotName = regexp.MustCompile("^[a-z0-9_]+$")
)
Functions ¶
func IsValidReplSlotName ¶
func IsWalFileName ¶
func PGLsnToInt ¶
func SetLogger ¶
func SetLogger(l *zap.SugaredLogger)
func WalFileNameNoTimeLine ¶
Types ¶
type ConnParams ¶
func ParseConnString ¶
func ParseConnString(name string) (ConnParams, error)
ParseConnString parses the options from name and adds them to the values.
The parsing code is based on conninfo_parse from libpq's fe-connect.c
func URLToConnParams ¶
func URLToConnParams(urlStr string) (ConnParams, error)
URLToConnParams creates the connParams from the url.
func (ConnParams) ConnString ¶
func (p ConnParams) ConnString() string
ConnString returns a connection string, its entries are sorted so the returned string can be reproducible and comparable
func (ConnParams) Copy ¶
func (cp ConnParams) Copy() ConnParams
func (ConnParams) Del ¶
func (cp ConnParams) Del(k string)
func (ConnParams) Equals ¶
func (cp ConnParams) Equals(cp2 ConnParams) bool
func (ConnParams) Get ¶
func (cp ConnParams) Get(k string) (v string)
func (ConnParams) Isset ¶
func (cp ConnParams) Isset(k string) bool
func (ConnParams) Set ¶
func (cp ConnParams) Set(k, v string)
type InitConfig ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) CreateReplicationSlot ¶
func (*Manager) CurParameters ¶
func (p *Manager) CurParameters() common.Parameters
func (*Manager) CurRecoveryOptions ¶ added in v0.16.7
func (p *Manager) CurRecoveryOptions() *RecoveryOptions
func (*Manager) DropReplicationSlot ¶
func (*Manager) GetConfigFilePGParameters ¶
func (p *Manager) GetConfigFilePGParameters() (common.Parameters, error)
func (*Manager) GetReplicationSlots ¶
func (*Manager) GetSyncStandbys ¶ added in v0.12.0
func (*Manager) GetSystemData ¶
func (p *Manager) GetSystemData() (*SystemData, error)
func (*Manager) GetSystemdID ¶
func (*Manager) GetTimelinesHistory ¶
func (p *Manager) GetTimelinesHistory(timeline uint64) ([]*TimelineHistory, error)
func (*Manager) Init ¶
func (p *Manager) Init(initConfig *InitConfig) error
func (*Manager) IsInitialized ¶
func (*Manager) IsRestartRequired ¶ added in v0.16.7
IsRestartRequired returns if a postgres restart is necessary
func (*Manager) OlderWalFile ¶
func (*Manager) SetParameters ¶
func (p *Manager) SetParameters(parameters common.Parameters)
func (*Manager) SetRecoveryOptions ¶ added in v0.16.7
func (p *Manager) SetRecoveryOptions(recoveryOptions *RecoveryOptions)
func (*Manager) SetupRoles ¶
func (*Manager) StartTmpMerged ¶
StartTmpMerged starts postgres with a conf file different than postgresql.conf, including it at the start of the conf if it exists
func (*Manager) Stop ¶
Stop tries to stop an instance. An error will be returned if the instance isn't started, stop fails or times out (60 second).
func (*Manager) StopIfStarted ¶
StopIfStarted checks if the instance is started, then calls stop and then check if the instance is really stopped
func (*Manager) SyncFromFollowed ¶
func (p *Manager) SyncFromFollowed(followedConnParams ConnParams, replSlot string) error
func (*Manager) SyncFromFollowedPGRewind ¶
func (p *Manager) SyncFromFollowedPGRewind(followedConnParams ConnParams, password string) error
func (*Manager) UpdateCurHba ¶
func (p *Manager) UpdateCurHba()
func (*Manager) UpdateCurParameters ¶
func (p *Manager) UpdateCurParameters()
func (*Manager) UpdateCurRecoveryOptions ¶ added in v0.16.7
func (p *Manager) UpdateCurRecoveryOptions()
type PGManager ¶ added in v0.16.7
type PGManager interface {
GetTimelinesHistory(timeline uint64) ([]*TimelineHistory, error)
}
type RecoveryMode ¶ added in v0.16.7
type RecoveryMode int
const ( RecoveryModeNone RecoveryMode = iota RecoveryModeStandby RecoveryModeRecovery )
type RecoveryOptions ¶ added in v0.16.7
type RecoveryOptions struct { RecoveryMode RecoveryMode RecoveryParameters common.Parameters }
func NewRecoveryOptions ¶ added in v0.16.7
func NewRecoveryOptions() *RecoveryOptions
func (*RecoveryOptions) DeepCopy ¶ added in v0.16.7
func (r *RecoveryOptions) DeepCopy() *RecoveryOptions
type SystemData ¶
func GetSystemData ¶
func GetSystemData(ctx context.Context, replConnParams ConnParams) (*SystemData, error)