blob: 934d69c49a6193dc3aef3f44d372e7d661f1428a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package repocleaner
import (
"context"
"github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore"
)
// LogWarnAction is an implementation of the Action interface that allows to log a warning message
// for the repositories that are not known for the praefect.
type LogWarnAction struct {
logger logrus.FieldLogger
}
// NewLogWarnAction return new instance of the LogWarnAction.
func NewLogWarnAction(logger logrus.FieldLogger) *LogWarnAction {
return &LogWarnAction{
logger: logger.WithField("component", "repocleaner.log_warn_action"),
}
}
// Perform logs a warning for each repository that is not known to praefect.
func (al LogWarnAction) Perform(_ context.Context, notExisting []datastore.RepositoryClusterPath) error {
for _, entry := range notExisting {
al.logger.WithFields(logrus.Fields{
"virtual_storage": entry.VirtualStorage,
"storage": entry.Storage,
"relative_replica_path": entry.RelativeReplicaPath,
}).Warn("repository is not managed by praefect")
}
return nil
}
|