Skip to content

codeintel: Add UpdateUploadRetention

Warren Gifford requested to merge ef/retention-upload-update into main

Created by: efritz

This PR adds the UpdateUploadRetention method to dbstore. This method bulk updates a set of uploads to either be marked as expired, or to have their last data retention scan timestamp updated. We also add additional options to GetUploads to control conditions relating to the expired flag and last data retention scan timestamp.

The worker will have the following rough outline:

func processUploadsFor(repositoryID int) {
    var protected []int
    var expired []int
    for _, upload := range dbStore.GetUploads(ctx, {AllowExpired: false, LastRetentionScanBefore: start}) {
        // process upload
        if isExpired {
          expired = append(expired, upload.ID)
        } else {
          protected = append(protected, uploadID)
        }
    }

    dbStore.UpdateUploadRetention(ctx, protected, expired)
}

Merge request reports

Loading