Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acquirer ¶ added in v14.4.0
type Acquirer interface { // Populate adds provided storage into the pool of entries to acquire. Populate(ctx context.Context, virtualStorage, storage string) error // AcquireNextStorage acquires next storage based on the inactive time. AcquireNextStorage(ctx context.Context, inactive, updatePeriod time.Duration) (*datastore.ClusterPath, func() error, error) }
Acquirer acquires storage for processing and no any other Acquirer can acquire it again until it is released.
type Action ¶ added in v14.4.0
type Action interface { // Perform runs actual action for non-existing repositories. Perform(ctx context.Context, notExisting []datastore.RepositoryClusterPath) error }
Action is a procedure to be executed on the repositories that doesn't exist in praefect database.
type Cfg ¶ added in v14.4.0
type Cfg struct { // RunInterval: the check runs if the previous operation was done at least RunInterval before. RunInterval time.Duration // LivenessInterval: an update runs on the locked entity with provided period to signal that entity is in use. LivenessInterval time.Duration // RepositoriesInBatch is the number of repositories to pass as a batch for processing. RepositoriesInBatch int }
Cfg contains set of configuration parameters to run Runner.
type LogWarnAction ¶ added in v14.4.0
type LogWarnAction struct {
// contains filtered or unexported fields
}
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.
func NewLogWarnAction ¶ added in v14.4.0
func NewLogWarnAction(logger logrus.FieldLogger) *LogWarnAction
NewLogWarnAction return new instance of the LogWarnAction.
func (LogWarnAction) Perform ¶ added in v14.4.0
func (al LogWarnAction) Perform(_ context.Context, notExisting []datastore.RepositoryClusterPath) error
Perform logs a warning for each repository that is not known to praefect.
type Runner ¶ added in v14.4.0
type Runner struct {
// contains filtered or unexported fields
}
Runner scans healthy gitaly nodes for the repositories, verifies if found repositories are known by praefect and runs a special action.
func NewRunner ¶ added in v14.4.0
func NewRunner(cfg Cfg, logger logrus.FieldLogger, healthChecker praefect.HealthChecker, conns praefect.Connections, stateOwner StateOwner, acquirer Acquirer, action Action) *Runner
NewRunner returns instance of the Runner.
type StateOwner ¶ added in v14.4.0
type StateOwner interface { // DoesntExist returns RepositoryClusterPath for each repository that doesn't exist in the database // by querying repositories and storage_repositories tables. DoesntExist(ctx context.Context, virtualStorage, storage string, replicaPaths []string) ([]datastore.RepositoryClusterPath, error) }
StateOwner performs check for the existence of the repositories.
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
Walker allows walk by the repositories of the gitaly storage.
func NewWalker ¶
func NewWalker(conns praefect.Connections, batchSize int) *Walker
NewWalker returns a new *Walker instance.
func (*Walker) ExecOnRepositories ¶
func (wr *Walker) ExecOnRepositories(ctx context.Context, virtualStorage, storage string, action func([]datastore.RepositoryClusterPath) error) error
ExecOnRepositories runs through all the repositories on a Gitaly storage and executes the provided action. The processing is done in batches to reduce cost of operations.