MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / BuildPostgresOptions

Method BuildPostgresOptions

api/v1/cluster_funcs.go:1522–1553  ·  view source on GitHub ↗

BuildPostgresOptions create the list of options that should be added to the PostgreSQL configuration to recover given a certain target

()

Source from the content-addressed store, hash-verified

1520// should be added to the PostgreSQL configuration to
1521// recover given a certain target
1522func (target *RecoveryTarget) BuildPostgresOptions() string {
1523 if target == nil {
1524 return ""
1525 }
1526
1527 options := map[string]string{}
1528 if target.TargetTLI != "" {
1529 options["recovery_target_timeline"] = target.TargetTLI
1530 }
1531 if target.TargetXID != "" {
1532 options["recovery_target_xid"] = target.TargetXID
1533 }
1534 if target.TargetName != "" {
1535 options["recovery_target_name"] = target.TargetName
1536 }
1537 if target.TargetLSN != "" {
1538 options["recovery_target_lsn"] = target.TargetLSN
1539 }
1540 if target.TargetTime != "" {
1541 options["recovery_target_time"] = pgTime.ConvertToPostgresFormat(target.TargetTime)
1542 }
1543 if target.TargetImmediate != nil && *target.TargetImmediate {
1544 options["recovery_target"] = "immediate"
1545 }
1546 if target.Exclusive != nil && *target.Exclusive {
1547 options["recovery_target_inclusive"] = "false"
1548 } else {
1549 options["recovery_target_inclusive"] = "true"
1550 }
1551
1552 return configfile.RenderPostgresConfiguration(options)
1553}
1554
1555// ApplyInto applies the content of the probe configuration in a Kubernetes
1556// probe

Callers 2

Calls 1

Tested by

no test coverage detected