Documentation
¶
Index ¶
- func CalculateNextSlice(counter, totalPages, runsPerHour int64) (from, count int64)
- type Batcher
- type DbCleanupService
- func (dc *DbCleanupService) CompactLogs(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) LockInvocationsWithNoRecentEvents(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveBuildsWithoutInvocations(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveInactiveUsers(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveIncompleteLogs(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveOldInvocations(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveOrphanedTestTargets(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveTargetKindMappings(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveUnusedDigests(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveUnusedFilePaths(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveUnusedFiles(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) RemoveUnusedTargets(ctx context.Context) (int64, error)
- func (dc *DbCleanupService) StartDbCleanupService(ctx context.Context, group program.Group)
- func (dc *DbCleanupService) UpdateInvocationEndedAtFromEvents(ctx context.Context) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateNextSlice ¶
CalculateNextSlice is exported for testing.
Types ¶
type Batcher ¶
type Batcher interface {
Batch(context.Context, func(context.Context, int64) (int64, error)) (int64, error)
}
Batcher is a utility that batches executions of an operation into chunks.
type DbCleanupService ¶
type DbCleanupService struct {
// contains filtered or unexported fields
}
DbCleanupService a service that performs periodic cleanup of the database to remove old data that is no longer needed, and to compact data in a format more suitable for storage.
func NewDbCleanupService ¶
func NewDbCleanupService( db database.Client, clock clock.Clock, batcher Batcher, cleanupConfiguration *bb_portal.Database_CleanupConfiguration, tracerProvider trace.TracerProvider, ) (*DbCleanupService, error)
NewDbCleanupService creates a new DbCleanupService.
func (*DbCleanupService) CompactLogs ¶
func (dc *DbCleanupService) CompactLogs(ctx context.Context) (int64, error)
CompactLogs compacts incomplete build logs by merging log entries for the same invocation.
func (*DbCleanupService) LockInvocationsWithNoRecentEvents ¶
func (dc *DbCleanupService) LockInvocationsWithNoRecentEvents(ctx context.Context) (int64, error)
LockInvocationsWithNoRecentEvents locks invocations that have not received any new events in a certain period of time.
func (*DbCleanupService) RemoveBuildsWithoutInvocations ¶
func (dc *DbCleanupService) RemoveBuildsWithoutInvocations(ctx context.Context) (int64, error)
RemoveBuildsWithoutInvocations removes builds that do not have any associated invocations.
func (*DbCleanupService) RemoveInactiveUsers ¶
func (dc *DbCleanupService) RemoveInactiveUsers(ctx context.Context) (int64, error)
RemoveInactiveUsers removes all users with no associated invocations.
func (*DbCleanupService) RemoveIncompleteLogs ¶
func (dc *DbCleanupService) RemoveIncompleteLogs(ctx context.Context) (int64, error)
RemoveIncompleteLogs deletes logs which have had their incomplete build logs normalized.
func (*DbCleanupService) RemoveOldInvocations ¶
func (dc *DbCleanupService) RemoveOldInvocations(ctx context.Context) (int64, error)
RemoveOldInvocations removes invocations that have completed before a certain cutoff time.
func (*DbCleanupService) RemoveOrphanedTestTargets ¶
func (dc *DbCleanupService) RemoveOrphanedTestTargets(ctx context.Context) (int64, error)
RemoveOrphanedTestTargets remove the test target marker from targest which no longer are referred to as tests by any invocation.
func (*DbCleanupService) RemoveTargetKindMappings ¶
func (dc *DbCleanupService) RemoveTargetKindMappings(ctx context.Context) (int64, error)
RemoveTargetKindMappings removes TargetKindMappings for BazelInvocations that are completed.
func (*DbCleanupService) RemoveUnusedDigests ¶
func (dc *DbCleanupService) RemoveUnusedDigests(ctx context.Context) (int64, error)
RemoveUnusedDigests removes digests that are no longer referenced by any files.
func (*DbCleanupService) RemoveUnusedFilePaths ¶
func (dc *DbCleanupService) RemoveUnusedFilePaths(ctx context.Context) (int64, error)
RemoveUnusedFilePaths removes file paths that are no longer referenced by any files.
func (*DbCleanupService) RemoveUnusedFiles ¶
func (dc *DbCleanupService) RemoveUnusedFiles(ctx context.Context) (int64, error)
RemoveUnusedFiles removes files that are no longer used
func (*DbCleanupService) RemoveUnusedTargets ¶
func (dc *DbCleanupService) RemoveUnusedTargets(ctx context.Context) (int64, error)
RemoveUnusedTargets removes Targets that have no InvocationTargets or TargetKindMappings.
func (*DbCleanupService) StartDbCleanupService ¶
func (dc *DbCleanupService) StartDbCleanupService(ctx context.Context, group program.Group)
StartDbCleanupService starts a goroutine that performs periodic cleanup of the database.
func (*DbCleanupService) UpdateInvocationEndedAtFromEvents ¶
func (dc *DbCleanupService) UpdateInvocationEndedAtFromEvents(ctx context.Context) (int64, error)
UpdateInvocationEndedAtFromEvents updates the ended_at timestamp of locked invocations based on the latest event metadata.