Skip to content

Commit a98f6f3

Browse files
committed
chore: move errs to the errors file
Signed-off-by: Armando Ruocco <[email protected]>
1 parent 51b703b commit a98f6f3

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/cnpgi/common/errors.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
package common
22

33
import (
4+
"fmt"
5+
46
"google.golang.org/grpc/codes"
57
"google.golang.org/grpc/status"
68
)
79

10+
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
11+
var ErrEndOfWALStreamReached = status.Errorf(codes.NotFound, "end of WAL reached")
12+
13+
// ErrMissingPermissions is raised when the sidecar has no
14+
// permission to download the credentials needed to reach
15+
// the object storage.
16+
// This will be fixed by the reconciliation loop in the
17+
// operator plugin.
18+
var ErrMissingPermissions = fmt.Errorf("no permission to download the backup credentials, retrying")
19+
820
// newWALNotFoundError returns a error that states that a
921
// certain WAL file has not been found. This error is
1022
// compatible with GRPC status codes, resulting in a 404

internal/cnpgi/common/wal.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import (
1818
"github.com/cloudnative-pg/machinery/pkg/fileutils"
1919
walUtils "github.com/cloudnative-pg/machinery/pkg/fileutils/wals"
2020
"github.com/cloudnative-pg/machinery/pkg/log"
21-
"google.golang.org/grpc/codes"
22-
"google.golang.org/grpc/status"
2321
apierrors "k8s.io/apimachinery/pkg/api/errors"
2422
"k8s.io/apimachinery/pkg/types"
2523
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -29,13 +27,6 @@ import (
2927
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config"
3028
)
3129

32-
// ErrMissingPermissions is raised when the sidecar has no
33-
// permission to download the credentials needed to reach
34-
// the object storage.
35-
// This will be fixed by the reconciliation loop in the
36-
// operator plugin.
37-
var ErrMissingPermissions = fmt.Errorf("no permission to download the backup credentials, retrying")
38-
3930
// SpoolManagementError is raised when a spool management
4031
// error has been detected
4132
type SpoolManagementError struct {
@@ -459,9 +450,6 @@ func gatherWALFilesToRestore(walName string, parallel int) (walList []string, er
459450
return walList, err
460451
}
461452

462-
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
463-
var ErrEndOfWALStreamReached = status.Errorf(codes.NotFound, "end of WAL reached")
464-
465453
// checkEndOfWALStreamFlag returns ErrEndOfWALStreamReached if the flag is set in the restorer.
466454
func checkEndOfWALStreamFlag(walRestorer *barmanRestorer.WALRestorer) error {
467455
contain, err := walRestorer.IsEndOfWALStream()

0 commit comments

Comments
 (0)