Documentation
¶
Index ¶
- type ExtensionInfo
- type ExtensionStatus
- type HealthServer
- func (s *HealthServer) ConfigFromFile(maxConn int, dbType sysinfo.DBType) error
- func (s *HealthServer) LoadServiceConfigs()
- func (s *HealthServer) SaveConfigsToDir(dir string) error
- func (s *HealthServer) SetConfiguration(maxConn int, dbType sysinfo.DBType, tunedParams *pgtune.TunedParameters)
- func (s *HealthServer) Start() error
- func (s *HealthServer) Stop(ctx context.Context) error
- type PGVersion
- type Postgres
- func (p *Postgres) Backup() error
- func (p *Postgres) DescribeConfig() ([]schemas.Param, error)
- func (p *Postgres) DetectVersion() (int, error)
- func (p *Postgres) Exists() bool
- func (p *Postgres) GetStderr() string
- func (p *Postgres) GetStdout() string
- func (p *Postgres) GetSupportedExtensions() []string
- func (p *Postgres) GetVersion() PGVersion
- func (p *Postgres) Health() error
- func (p *Postgres) InitDB() error
- func (p *Postgres) InstallExtensions(extensions []string) error
- func (p *Postgres) IsRunning() bool
- func (p *Postgres) ListAvailableExtensions() ([]ExtensionInfo, error)
- func (p *Postgres) ListInstalledExtensions() ([]ExtensionInfo, error)
- func (p *Postgres) ResetPassword(newPassword utils.SensitiveString) error
- func (p *Postgres) SQL(sqlQuery string) ([]map[string]interface{}, error)
- func (p *Postgres) Start() error
- func (p *Postgres) Stop() error
- func (p *Postgres) Upgrade(targetVersion int) error
- func (p *Postgres) Validate(config []byte) error
- type ServiceStatus
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtensionStatus ¶
type ExtensionStatus struct {
Name string `json:"name"`
SQLName string `json:"sql_name"`
Installed bool `json:"installed"`
Version string `json:"version,omitempty"`
Required bool `json:"required"`
Available bool `json:"available"`
Error string `json:"error,omitempty"`
}
ExtensionStatus represents the status of a PostgreSQL extension
type HealthServer ¶
type HealthServer struct {
Port int
ConfigDir string
SystemInfo *sysinfo.SystemInfo
TunedParams *pgtune.TunedParameters
DBType sysinfo.DBType
MaxConn int
// Service configurations
PostgresConfig *pkg.PostgresConf
PgBouncerConfig *pkg.PgBouncerConf
PostgRESTConfig *pkg.PostgrestConf
WalgConfig *pkg.WalgConf
// contains filtered or unexported fields
}
HealthServer provides health check and configuration endpoints
func NewHealthServer ¶
func NewHealthServer(port int, configDir string) *HealthServer
NewHealthServer creates a new health check server
func (*HealthServer) ConfigFromFile ¶
func (s *HealthServer) ConfigFromFile(maxConn int, dbType sysinfo.DBType) error
ConfigFromFile loads configuration from files in the config directory
func (*HealthServer) LoadServiceConfigs ¶
func (s *HealthServer) LoadServiceConfigs()
LoadServiceConfigs loads and hydrates service configurations with defaults
func (*HealthServer) SaveConfigsToDir ¶
func (s *HealthServer) SaveConfigsToDir(dir string) error
SaveConfigsToDir saves all configuration files to the specified directory
func (*HealthServer) SetConfiguration ¶
func (s *HealthServer) SetConfiguration(maxConn int, dbType sysinfo.DBType, tunedParams *pgtune.TunedParameters)
SetConfiguration sets the tuning configuration for the server
func (*HealthServer) Start ¶
func (s *HealthServer) Start() error
Start starts the health check server
type Postgres ¶
type Postgres struct {
Config *pkg.PostgresConf
DataDir string
BinDir string // Auto-resolved based on detected version
// contains filtered or unexported fields
}
func NewPostgres ¶
func NewPostgres(config *pkg.PostgresConf, dataDir string) *Postgres
NewPostgres creates a new PostgreSQL service instance
func (*Postgres) DescribeConfig ¶
DescribeConfig executes `postgres --describe-config` and returns parsed parameters
func (*Postgres) DetectVersion ¶
DetectVersion reads the PostgreSQL version from the data directory
func (*Postgres) GetSupportedExtensions ¶
GetSupportedExtensions returns the list of well-known supported extensions
func (*Postgres) GetVersion ¶
func (*Postgres) InstallExtensions ¶
InstallExtensions installs the specified PostgreSQL extensions
func (*Postgres) ListAvailableExtensions ¶
func (p *Postgres) ListAvailableExtensions() ([]ExtensionInfo, error)
ListAvailableExtensions returns a list of available PostgreSQL extensions
func (*Postgres) ListInstalledExtensions ¶
func (p *Postgres) ListInstalledExtensions() ([]ExtensionInfo, error)
ListInstalledExtensions returns a list of installed PostgreSQL extensions
func (*Postgres) ResetPassword ¶
func (p *Postgres) ResetPassword(newPassword utils.SensitiveString) error
ResetPassword resets the PostgreSQL superuser password using a temporary server instance
type ServiceStatus ¶
type ServiceStatus struct {
Name string `json:"name"`
Status string `json:"status"` // "running", "stopped", "unknown"
Port int `json:"port,omitempty"`
PortOpen bool `json:"port_open"`
Enabled bool `json:"enabled"`
Uptime string `json:"uptime,omitempty"`
RestartCount int `json:"restart_count,omitempty"`
Details string `json:"details,omitempty"`
}
ServiceStatus represents the status of a service
type ValidationError ¶
type ValidationError = pkg.ValidationError