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

Function restoreViaPlugin

pkg/management/postgres/restore.go:1060–1080  ·  view source on GitHub ↗

restoreViaPlugin tries to restore the cluster using a plugin if available and enabled. Returns true if a restore plugin was found and any error encountered.

(
	ctx context.Context,
	cluster *apiv1.Cluster,
	plugin *apiv1.PluginConfiguration,
)

Source from the content-addressed store, hash-verified

1058// restoreViaPlugin tries to restore the cluster using a plugin if available and enabled.
1059// Returns true if a restore plugin was found and any error encountered.
1060func restoreViaPlugin(
1061 ctx context.Context,
1062 cluster *apiv1.Cluster,
1063 plugin *apiv1.PluginConfiguration,
1064) (*restore.RestoreResponse, error) {
1065 contextLogger := log.FromContext(ctx)
1066
1067 plugins := repository.New()
1068 defer plugins.Close()
1069
1070 pluginEnabledSet := stringset.New()
1071 pluginEnabledSet.Put(plugin.Name)
1072 pClient, err := pluginClient.NewClient(ctx, pluginEnabledSet)
1073 if err != nil {
1074 contextLogger.Error(err, "Error while loading required plugins")
1075 return nil, err
1076 }
1077 defer pClient.Close(ctx)
1078
1079 return pClient.Restore(ctx, cluster)
1080}

Callers 1

RestoreMethod · 0.85

Calls 4

NewFunction · 0.92
CloseMethod · 0.65
RestoreMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected