From 37439ea175fc6c495023145b75e9a2363d23890e Mon Sep 17 00:00:00 2001 From: Armando Ruocco Date: Wed, 24 Sep 2025 15:40:46 +0200 Subject: [PATCH] chore: move errs to the errors file Signed-off-by: Armando Ruocco --- internal/cnpgi/common/errors.go | 12 ++++++++++++ internal/cnpgi/common/wal.go | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/cnpgi/common/errors.go b/internal/cnpgi/common/errors.go index e475002..16b5f5b 100644 --- a/internal/cnpgi/common/errors.go +++ b/internal/cnpgi/common/errors.go @@ -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 diff --git a/internal/cnpgi/common/wal.go b/internal/cnpgi/common/wal.go index 46fa501..0ccc1ac 100644 --- a/internal/cnpgi/common/wal.go +++ b/internal/cnpgi/common/wal.go @@ -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()