Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acquirer ¶
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 ¶
type Action interface { // Perform runs actual action for non-existing repositories. Perform(ctx context.Context, virtualStorage, storage string, replicaPaths []string) error }
Action is a procedure to be executed on the repositories that doesn't exist in praefect database.
type Cfg ¶
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 ¶
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 ¶
func NewLogWarnAction(logger logrus.FieldLogger) *LogWarnAction
NewLogWarnAction return new instance of the LogWarnAction.
type Runner ¶
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 ¶
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 ¶
type StateOwner interface { // DoesntExist returns replica path 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) ([]string, 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 (*Walker) ExecOnRepositories ¶
func (wr *Walker) ExecOnRepositories(ctx context.Context, virtualStorage, storage string, action func(string, string, []string) 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.