Documentation ¶
Overview ¶
Package webserver contains the web server powering probes, backups and metrics
Index ¶
Constants ¶
const ( // DefaultReadTimeout is the default value to be used by the webservers DefaultReadTimeout = 20 * time.Second // DefaultReadHeaderTimeout is the default value to be used by the webservers DefaultReadHeaderTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupClient ¶ added in v1.21.1
type BackupClient interface { StatusWithErrors(ctx context.Context, podIP string) (*Response[BackupResultData], error) Start( ctx context.Context, podIP string, sbq StartBackupRequest, ) error Stop(ctx context.Context, podIP string, sbq StopBackupRequest) error }
BackupClient is a struct capable of interacting with the instance backup endpoints
func NewBackupClient ¶ added in v1.21.1
func NewBackupClient() BackupClient
NewBackupClient creates a client capable of interacting with the instance backup endpoints
type BackupConnectionPhase ¶ added in v1.21.1
type BackupConnectionPhase string
BackupConnectionPhase a connection phase of the backup
const ( Starting BackupConnectionPhase = "starting" Started BackupConnectionPhase = "started" Closing BackupConnectionPhase = "closing" Completed BackupConnectionPhase = "completed" )
A backup phase
type BackupResultData ¶ added in v1.21.1
type BackupResultData struct { BeginLSN postgresUtils.LSN `json:"beginLSN,omitempty"` EndLSN postgresUtils.LSN `json:"endLSN,omitempty"` LabelFile []byte `json:"labelFile,omitempty"` SpcmapFile []byte `json:"spcmapFile,omitempty"` BackupName string `json:"backupName,omitempty"` Phase BackupConnectionPhase `json:"phase,omitempty"` }
BackupResultData is the result of executing pg_start_backup and pg_stop_backup
type Error ¶ added in v1.21.1
type Error struct { // One of a server-defined set of error codes Code string `json:"code"` // A human-readable representation of the error. Message string `json:"message"` // An array of details about specific errors that led to this reported error. Details []Error `json:"details,omitempty"` }
Error an error response from http webserver
type PluginBackupCommand ¶ added in v1.23.0
type PluginBackupCommand struct { Cluster *apiv1.Cluster Backup *apiv1.Backup Client client.Client Recorder record.EventRecorder Log log.Logger }
PluginBackupCommand represent a backup command that is being executed
func NewPluginBackupCommand ¶ added in v1.23.0
func NewPluginBackupCommand( cluster *apiv1.Cluster, backup *apiv1.Backup, client client.Client, recorder record.EventRecorder, ) *PluginBackupCommand
NewPluginBackupCommand initializes a BackupCommand object, taking a physical backup using Barman Cloud
func (*PluginBackupCommand) Start ¶ added in v1.23.0
func (b *PluginBackupCommand) Start(ctx context.Context)
Start starts a backup using the Plugin
type Response ¶ added in v1.21.1
type Response[T interface{}] struct { Data *T `json:"data,omitempty"` Error *Error `json:"error,omitempty"` }
Response a response from the http webserver
func (Response[T]) EnsureDataIsPresent ¶ added in v1.21.2
EnsureDataIsPresent returns an error if the data is field is nil
type StartBackupRequest ¶ added in v1.21.1
type StartBackupRequest struct { ImmediateCheckpoint bool `json:"immediateCheckpoint"` WaitForArchive bool `json:"waitForArchive"` BackupName string `json:"backupName"` Force bool `json:"force,omitempty"` }
StartBackupRequest the required data to execute the pg_start_backup
type StopBackupRequest ¶ added in v1.21.2
type StopBackupRequest struct {
BackupName string `json:"backupName"`
}
StopBackupRequest the required data to execute the pg_stop_backup
func NewStopBackupRequest ¶ added in v1.21.2
func NewStopBackupRequest(backupName string) *StopBackupRequest
NewStopBackupRequest constructor
type Webserver ¶
type Webserver struct {
// contains filtered or unexported fields
}
Webserver contains a server that interacts with postgres instance
func NewLocalWebServer ¶
NewLocalWebServer returns a webserver that allows connection only from localhost
func NewRemoteWebServer ¶
func NewRemoteWebServer( instance *postgres.Instance, cancelFunc context.CancelFunc, exitedConditions concurrency.MultipleExecuted, ) (*Webserver, error)
NewRemoteWebServer returns a webserver that allows connection from external clients
func NewWebServer ¶
NewWebServer creates a Webserver given a postgres.Instance and a http.Server
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package metricserver contains the web server powering metrics
|
Package metricserver contains the web server powering metrics |