Documentation
¶
Overview ¶
Package catalog is the implementation of a backup catalog
Index ¶
- Constants
- type Catalog
- func (catalog *Catalog) FindBackupInfo(recoveryTarget recoveryTargetAdapter) (*PgbackrestBackup, error)
- func (catalog *Catalog) FirstRecoverabilityPoint() *time.Time
- func (catalog *Catalog) GetBackupIDFromAnnotatedName(backupName string) string
- func (catalog *Catalog) GetBackupIDs() []string
- func (catalog Catalog) GetBackupMethod() string
- func (catalog *Catalog) GetFirstRecoverabilityPoint() *time.Time
- func (catalog *Catalog) GetLastSuccessfulBackupTime() *time.Time
- func (catalog *Catalog) LatestBackupInfo() *PgbackrestBackup
- type PgbackrestBackup
- type PgbackrestBackupDatabase
- type PgbackrestBackupLSN
- type PgbackrestBackupTime
- type PgbackrestBackupWALArchive
- type PgbackrestWALArchive
Constants ¶
const ( // LatestTimelineID is used to mark the "latest" timeline option LatestTimelineID = -1 // BackupNameAnnotation is used to add CNPG backup name to the pgBackRest backup's // metadata as an annotation. This makes it possible to trace specific backup to // a Backup resource. BackupNameAnnotation = "cnpg-backup-name" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
Archive []PgbackrestWALArchive `json:"archive"`
Backups []PgbackrestBackup `json:"backup"`
Stanza string `json:"name"`
Databases []PgbackrestBackupDatabase `json:"db"`
Encryption string `json:"cipher"`
}
Catalog represents a catalog of archive and backup storages of a specific stanza
func NewCatalogFromPgbackrestInfo ¶
NewCatalogFromPgbackrestInfo parses the output of pgbackrest info
func NewSingleBackupCatalogFromPgbackrestInfo ¶
NewSingleBackupCatalogFromPgbackrestInfo parses the output of pgbackrest info targeting a single backup via "--set". While structure is the same as for the full backups list there is only a single backup in the list but with additional fields included.
func (*Catalog) FindBackupInfo ¶
func (catalog *Catalog) FindBackupInfo( recoveryTarget recoveryTargetAdapter, ) (*PgbackrestBackup, error)
FindBackupInfo finds the backup info that should be used to file a PITR request via target parameters specified within `RecoveryTarget`
func (*Catalog) FirstRecoverabilityPoint ¶
FirstRecoverabilityPoint gets the start time of the first backup in the catalog
func (*Catalog) GetBackupIDFromAnnotatedName ¶ added in v0.1.1
GetBackupIDFromAnnotatedName returns the ID of the backup with the custom CNPG annotation set to the provided name.
func (*Catalog) GetBackupIDs ¶
GetBackupIDs returns the list of backup IDs in the catalog
func (Catalog) GetBackupMethod ¶
GetBackupMethod returns the backup method
func (*Catalog) GetFirstRecoverabilityPoint ¶
GetFirstRecoverabilityPoint see FirstRecoverabilityPoint. This is needed to adhere to the common backup interface.
func (*Catalog) GetLastSuccessfulBackupTime ¶
GetLastSuccessfulBackupTime gets the end time of the last successful backup or nil if no backup was successful
func (*Catalog) LatestBackupInfo ¶
func (catalog *Catalog) LatestBackupInfo() *PgbackrestBackup
LatestBackupInfo gets the information about the latest successful backup
type PgbackrestBackup ¶
type PgbackrestBackup struct {
Annotations map[string]string `json:"annotation,omitempty"`
Time PgbackrestBackupTime `json:"timestamp"`
WAL PgbackrestBackupWALArchive `json:"archive"`
LSN PgbackrestBackupLSN `json:"lsn"`
// The ID of the backup - reusing pgbackrest's label
ID string `json:"label"`
// The ID of the previous backup for incremental and differential backups
Prior string `json:"prior,omitempty"`
// Backup type
Type string `json:"type"`
}
PgbackrestBackup represent a backup as created by pgbackrest
type PgbackrestBackupDatabase ¶
type PgbackrestBackupDatabase struct {
ID int `json:"id"`
RepoKey int `json:"repo_key"`
SystemID int64 `json:"system-id,omitempty"`
Version string `json:"version,omitempty"`
}
PgbackrestBackupDatabase contains identifying metadata of the database in the stanza
type PgbackrestBackupLSN ¶
type PgbackrestBackupLSN struct {
// The LSN where the backup started
Start string `json:"start"`
// The LSN where the backup ended
Stop string `json:"stop"`
}
PgbackrestBackupLSN represents an LSN range the backup contains
type PgbackrestBackupTime ¶
type PgbackrestBackupTime struct {
// The moment where the backup started
Start int64 `json:"start"`
// The moment where the backup ended
Stop int64 `json:"stop"`
}
PgbackrestBackupTime represents a time span of the creation of a single backup
type PgbackrestBackupWALArchive ¶
type PgbackrestBackupWALArchive struct {
// The WAL where the backup started
Start string `json:"start"`
// The WAL where the backup ended
Stop string `json:"stop"`
}
PgbackrestBackupWALArchive represents a WAL archive range the backup contains
type PgbackrestWALArchive ¶
type PgbackrestWALArchive struct {
ID string `json:"id"`
// First WAL in the archive
Min string `json:"min"`
// Last WAL in the archive
Max string `json:"max"`
Database PgbackrestBackupDatabase `json:"database"`
}
PgbackrestWALArchive represents a pgBackRest WAL archive for a specific database