Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DailyWorker ¶
type DailyWorker struct {
// contains filtered or unexported fields
}
DailyWorker allows for a storage job to be executed on a daily schedule
func NewDailyWorker ¶
func NewDailyWorker() DailyWorker
NewDailyWorker returns an initialized daily worker
func (DailyWorker) StartDaily ¶
func (dw DailyWorker) StartDaily(ctx context.Context, l logrus.FieldLogger, schedule config.DailyJob, job StoragesJob) error
StartDaily will run the provided job every day at the specified time for the specified duration. Only the specified storages wil be worked on.
type Optimizer ¶
type Optimizer interface {
OptimizeRepository(context.Context, *gitalypb.OptimizeRepositoryRequest, ...grpc.CallOption) (*gitalypb.OptimizeRepositoryResponse, error)
}
Optimizer knows how to optimize a repository
type StoragesJob ¶
StoragesJob runs a job on storages. The string slice param indicates which storages are currently enabled for the feature.
func OptimizeReposRandomly ¶
func OptimizeReposRandomly(storages []config.Storage, optimizer Optimizer, ticker helper.Ticker, rand *rand.Rand) StoragesJob
OptimizeReposRandomly returns a function to walk through each storage and attempts to optimize any repos encountered. The ticker is used to rate-limit optimizations.
Only storage paths that map to an enabled storage name will be walked. Any storage paths shared by multiple storages will only be walked once.
Any errors during the optimization will be logged. Any other errors will be returned and cause the walk to end prematurely.