chore: move errs to the errors file

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This commit is contained in:
Armando Ruocco 2025-09-24 15:40:46 +02:00 committed by Marco Nenciarini
parent e5a0aeed34
commit 37439ea175
2 changed files with 12 additions and 12 deletions

View File

@ -1,10 +1,22 @@
package common
import (
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
var ErrEndOfWALStreamReached = status.Errorf(codes.NotFound, "end of WAL reached")
// ErrMissingPermissions is raised when the sidecar has no
// permission to download the credentials needed to reach
// the object storage.
// This will be fixed by the reconciliation loop in the
// operator plugin.
var ErrMissingPermissions = fmt.Errorf("no permission to download the backup credentials, retrying")
// newWALNotFoundError returns a error that states that a
// certain WAL file has not been found. This error is
// compatible with GRPC status codes, resulting in a 404

View File

@ -18,8 +18,6 @@ import (
"github.com/cloudnative-pg/machinery/pkg/fileutils"
walUtils "github.com/cloudnative-pg/machinery/pkg/fileutils/wals"
"github.com/cloudnative-pg/machinery/pkg/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -29,13 +27,6 @@ import (
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config"
)
// ErrMissingPermissions is raised when the sidecar has no
// permission to download the credentials needed to reach
// the object storage.
// This will be fixed by the reconciliation loop in the
// operator plugin.
var ErrMissingPermissions = fmt.Errorf("no permission to download the backup credentials, retrying")
// SpoolManagementError is raised when a spool management
// error has been detected
type SpoolManagementError struct {
@ -459,9 +450,6 @@ func gatherWALFilesToRestore(walName string, parallel int) (walList []string, er
return walList, err
}
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
var ErrEndOfWALStreamReached = status.Errorf(codes.NotFound, "end of WAL reached")
// checkEndOfWALStreamFlag returns ErrEndOfWALStreamReached if the flag is set in the restorer.
func checkEndOfWALStreamFlag(walRestorer *barmanRestorer.WALRestorer) error {
contain, err := walRestorer.IsEndOfWALStream()