Documentation
¶
Overview ¶
Package database provides a base mock for the Database interface. Embed BaseMockDB in test mocks and override only the methods you need.
Index ¶
- Constants
- Variables
- func IsForeignKeyViolation(err error) bool
- func IsUniqueViolation(err error) bool
- func IsValidBlobSHA256(s string) bool
- func UniqueViolationConstraint(err error) string
- type BaseMockDB
- func (m *BaseMockDB) AddBundleItem(ctx context.Context, item *models.ReleaseBundleItem) error
- func (m *BaseMockDB) AddBundleItems(ctx context.Context, bundleID string, items []*models.ReleaseBundleItem) error
- func (m *BaseMockDB) AddGroupMember(ctx context.Context, groupRepoID, memberRepoID string, priority int) error
- func (m *BaseMockDB) AddProjectMember(ctx context.Context, projectID, userID, role string) error
- func (m *BaseMockDB) AddUserToGroup(ctx context.Context, userID, groupID string) error
- func (m *BaseMockDB) ArtifactExists(ctx context.Context, sha256 string, repositoryID string) (bool, error)
- func (m *BaseMockDB) ArtifactExistsBySHA256(ctx context.Context, sha256 string) (string, bool, error)
- func (m *BaseMockDB) BeginBackupSnapshot(ctx context.Context, leaseTTL time.Duration) (SnapshotReader, error)
- func (m *BaseMockDB) BeginTx(ctx context.Context) (Transaction, error)
- func (m *BaseMockDB) BlobReferenceCount(ctx context.Context, sha256 string) (int, error)
- func (m *BaseMockDB) CargoIndexStamp(ctx context.Context, repoID, name string) (string, error)
- func (m *BaseMockDB) ChangeProjectGroup(ctx context.Context, projectID, groupID, newRole string, createdBy *string, ...) error
- func (m *BaseMockDB) ChangeProjectMember(ctx context.Context, projectID, userID, newRole string, guard ProjectRoleGuard) error
- func (m *BaseMockDB) ClaimPendingWebhookDeliveries(ctx context.Context, limit int, lease time.Duration) ([]*models.WebhookDelivery, error)
- func (m *BaseMockDB) ClaimPresignedUpload(ctx context.Context, repoID, id string, lease time.Duration) (bool, error)
- func (m *BaseMockDB) Close() error
- func (m *BaseMockDB) CondaRepodataStamp(ctx context.Context, repoID, platform string) (string, error)
- func (m *BaseMockDB) ConsumeSAMLAssertion(ctx context.Context, providerSlug, assertionID string, expiresAt time.Time) (bool, error)
- func (m *BaseMockDB) CountBlobsOnStorageBackend(ctx context.Context, backendID string) (int64, error)
- func (m *BaseMockDB) CountRepositories(ctx context.Context, formatFilter string) (int, error)
- func (m *BaseMockDB) CountRepositoriesByProject(ctx context.Context, projectIDs []string) (map[string]int, error)
- func (m *BaseMockDB) CountUsers(ctx context.Context) (int, error)
- func (m *BaseMockDB) CreateBackupJob(ctx context.Context, job *models.BackupJob) error
- func (m *BaseMockDB) CreateBootstrapAdmin(ctx context.Context, username, passwordHash string) (bool, error)
- func (m *BaseMockDB) CreateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
- func (m *BaseMockDB) CreateCargoCrate(ctx context.Context, crate *models.CargoCrate) error
- func (m *BaseMockDB) CreateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
- func (m *BaseMockDB) CreateComponent(ctx context.Context, component *models.Component) error
- func (m *BaseMockDB) CreateConanPackage(ctx context.Context, pkg *models.ConanPackage) error
- func (m *BaseMockDB) CreateCondaPackage(ctx context.Context, pkg *models.CondaPackage) error
- func (m *BaseMockDB) CreateDebPackage(ctx context.Context, pkg *models.Component, distID, compID string) error
- func (m *BaseMockDB) CreateDebianArchitecture(ctx context.Context, arch *models.DebianArchitecture) error
- func (m *BaseMockDB) CreateDebianComponent(ctx context.Context, comp *models.DebianComponent) error
- func (m *BaseMockDB) CreateDebianDistribution(ctx context.Context, dist *models.DebianDistribution) error
- func (m *BaseMockDB) CreateDockerBlob(ctx context.Context, blob *models.DockerBlob) error
- func (m *BaseMockDB) CreateDockerManifest(ctx context.Context, mf *models.DockerManifest) error
- func (m *BaseMockDB) CreateDockerUpload(ctx context.Context, upload *models.DockerUpload) error
- func (m *BaseMockDB) CreateGoModule(ctx context.Context, mod *models.GoModule) error
- func (m *BaseMockDB) CreateGroup(ctx context.Context, group *models.Group) (*models.Group, error)
- func (m *BaseMockDB) CreateHelmChart(ctx context.Context, chart *models.HelmChart) error
- func (m *BaseMockDB) CreateIvyArtifact(ctx context.Context, artifact *models.IvyArtifact) error
- func (m *BaseMockDB) CreateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
- func (m *BaseMockDB) CreateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
- func (m *BaseMockDB) CreateMavenArtifact(ctx context.Context, a *models.MavenArtifact) error
- func (m *BaseMockDB) CreateNPMPackage(ctx context.Context, p *models.NPMPackage) (*models.NPMPackage, error)
- func (m *BaseMockDB) CreateNPMVersion(ctx context.Context, v *models.NPMVersion) (*models.NPMVersion, error)
- func (m *BaseMockDB) CreateNuGetPackage(ctx context.Context, pkg *models.NuGetPackage) error
- func (m *BaseMockDB) CreatePackageDelta(ctx context.Context, delta *models.PackageDelta) error
- func (m *BaseMockDB) CreatePermissionAssignment(ctx context.Context, assignment *models.PermissionAssignment) error
- func (m *BaseMockDB) CreatePermissionTarget(ctx context.Context, target *models.PermissionTarget) (*models.PermissionTarget, error)
- func (m *BaseMockDB) CreatePresignedUpload(ctx context.Context, u *models.PresignedUpload) error
- func (m *BaseMockDB) CreatePresignedUploadCapped(ctx context.Context, u *models.PresignedUpload, maxPending int) error
- func (m *BaseMockDB) CreateProject(ctx context.Context, project *models.Project) error
- func (m *BaseMockDB) CreateProjectRepository(ctx context.Context, repo *models.Repository, memberIDs []string, ...) error
- func (m *BaseMockDB) CreateProjectToken(ctx context.Context, spec ProjectTokenSpec) (*models.Token, error)
- func (m *BaseMockDB) CreatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
- func (m *BaseMockDB) CreatePyPIPackage(ctx context.Context, pkg *models.PyPIPackage) error
- func (m *BaseMockDB) CreateRPMRepo(ctx context.Context, repo *models.RPMRepo) error
- func (m *BaseMockDB) CreateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
- func (m *BaseMockDB) CreateRepository(ctx context.Context, repo *models.Repository) error
- func (m *BaseMockDB) CreateRepositoryWithMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
- func (m *BaseMockDB) CreateRpmPackage(ctx context.Context, pkg *models.Component) error
- func (m *BaseMockDB) CreateRubyGem(ctx context.Context, gem *models.RubyGem) error
- func (m *BaseMockDB) CreateSBOMReport(ctx context.Context, report *models.SBOMReport) error
- func (m *BaseMockDB) CreateSBTArtifact(ctx context.Context, artifact *models.SBTArtifact) error
- func (m *BaseMockDB) CreateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
- func (m *BaseMockDB) CreateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
- func (m *BaseMockDB) CreateSession(ctx context.Context, session *models.Session) (*models.Session, error)
- func (m *BaseMockDB) CreateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
- func (m *BaseMockDB) CreateToken(ctx context.Context, token *models.Token) (*models.Token, error)
- func (m *BaseMockDB) CreateUser(ctx context.Context, user *models.User) (*models.User, error)
- func (m *BaseMockDB) CreateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
- func (m *BaseMockDB) CreateWebhook(ctx context.Context, wh *models.Webhook) error
- func (m *BaseMockDB) CreateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
- func (m *BaseMockDB) DecrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
- func (m *BaseMockDB) DeleteAIAnalysis(ctx context.Context, repoID, artifactID string) error
- func (m *BaseMockDB) DeleteArtifactProperty(ctx context.Context, repoID, artifactID, key string) error
- func (m *BaseMockDB) DeleteCargoCrate(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteCleanupPolicy(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteComponent(ctx context.Context, componentID string) error
- func (m *BaseMockDB) DeleteConanPackage(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteCondaPackage(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteDockerBlob(ctx context.Context, repoID, digest string) error
- func (m *BaseMockDB) DeleteDockerManifest(ctx context.Context, repoID, image, digest string) error
- func (m *BaseMockDB) DeleteDockerTag(ctx context.Context, repoID, image, name string) error
- func (m *BaseMockDB) DeleteDockerTagsByDigest(ctx context.Context, repoID, image, digest string) error
- func (m *BaseMockDB) DeleteDockerUpload(ctx context.Context, repositoryID, uploadUUID string) error
- func (m *BaseMockDB) DeleteExpiredProxyCacheEntries(ctx context.Context) (int64, error)
- func (m *BaseMockDB) DeleteGoModule(ctx context.Context, repoID, modulePath, version string) error
- func (m *BaseMockDB) DeleteGroup(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteHelmChart(ctx context.Context, repoID, name, version string) error
- func (m *BaseMockDB) DeleteIvyArtifact(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteLicensePolicy(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteMavenArtifact(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteNPMDistTag(ctx context.Context, packageID, tag string) error
- func (m *BaseMockDB) DeleteNPMPackage(ctx context.Context, packageID string) error
- func (m *BaseMockDB) DeleteNPMVersion(ctx context.Context, packageID, version string) error
- func (m *BaseMockDB) DeleteNuGetPackage(ctx context.Context, repoID, packageID, version string) error
- func (m *BaseMockDB) DeleteOtherSessionsByUser(ctx context.Context, userID, keepTokenHash string) error
- func (m *BaseMockDB) DeletePackageDelta(ctx context.Context, id string) error
- func (m *BaseMockDB) DeletePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
- func (m *BaseMockDB) DeletePermissionTarget(ctx context.Context, id string) error
- func (m *BaseMockDB) DeletePresignedUpload(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteProject(ctx context.Context, id string) error
- func (m *BaseMockDB) DeletePromotionPipeline(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteProxyCacheEntry(ctx context.Context, repoID, cacheKey string) error
- func (m *BaseMockDB) DeletePyPIPackage(ctx context.Context, repoID, name, version, filename string) error
- func (m *BaseMockDB) DeleteRawArtifact(ctx context.Context, repoID, path string) error
- func (m *BaseMockDB) DeleteReleaseBundle(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteRepository(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteRubyGem(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteSBOMReport(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteSBOMReportInRepo(ctx context.Context, repoID, id string) (string, error)
- func (m *BaseMockDB) DeleteSBTArtifact(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteSSOProvider(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteSession(ctx context.Context, tokenHash string) error
- func (m *BaseMockDB) DeleteSessionsByUser(ctx context.Context, userID string) error
- func (m *BaseMockDB) DeleteStorageBackend(ctx context.Context, id string) error
- func (m *BaseMockDB) DeleteVEXStatement(ctx context.Context, repoID, id string) error
- func (m *BaseMockDB) DeleteVulnScanResult(ctx context.Context, repoID, id string) error
- func (m *BaseMockDB) DeleteWebhook(ctx context.Context, id string) error
- func (m *BaseMockDB) EnsureBlob(ctx context.Context, sha256, mediaType string, size int64) (string, error)
- func (m *BaseMockDB) ExistingPresignedUploadIDs(ctx context.Context, ids []string) ([]string, error)
- func (m *BaseMockDB) GetAIAnalysis(ctx context.Context, repoID, artifactID string) (*models.AIAnalysis, error)
- func (m *BaseMockDB) GetArtifactProperty(ctx context.Context, repoID, artifactID, key string) (string, error)
- func (m *BaseMockDB) GetBackupJob(ctx context.Context, id string) (*models.BackupJob, error)
- func (m *BaseMockDB) GetBundleItem(ctx context.Context, bundleID, sha256 string) (*models.ReleaseBundleItem, error)
- func (m *BaseMockDB) GetCargoCrate(ctx context.Context, repoID, name, version string) (*models.CargoCrate, error)
- func (m *BaseMockDB) GetCleanupPolicy(ctx context.Context, id string) (*models.CleanupPolicy, error)
- func (m *BaseMockDB) GetComponentByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
- func (m *BaseMockDB) GetComponentByID(ctx context.Context, id string) (*models.Component, error)
- func (m *BaseMockDB) GetComponentBySHA256(ctx context.Context, repoID, sha256 string) (*models.Component, error)
- func (m *BaseMockDB) GetComponentsByRepo(ctx context.Context, repoID string) ([]models.Component, error)
- func (m *BaseMockDB) GetConanPackage(ctx context.Context, repoID string, key models.ConanFileKey) (*models.ConanPackage, error)
- func (m *BaseMockDB) GetCondaPackageFile(ctx context.Context, ...) (*models.CondaPackage, error)
- func (m *BaseMockDB) GetDB() *sql.DB
- func (m *BaseMockDB) GetDebBlobInfo(ctx context.Context, blobID string) (string, int64, error)
- func (m *BaseMockDB) GetDebPackageByID(ctx context.Context, id string) (*models.DebPackage, error)
- func (m *BaseMockDB) GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
- func (m *BaseMockDB) GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
- func (m *BaseMockDB) GetDebianDistribution(ctx context.Context, repoID string, name string) (*models.DebianDistribution, error)
- func (m *BaseMockDB) GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
- func (m *BaseMockDB) GetDebianPackageByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
- func (m *BaseMockDB) GetDebianPackagesByDistComp(ctx context.Context, repoID string, dist string, comp string, arch string) ([]models.Component, error)
- func (m *BaseMockDB) GetDockerBlob(ctx context.Context, repoID, digest string) (*models.DockerBlob, error)
- func (m *BaseMockDB) GetDockerManifest(ctx context.Context, repoID, image, digest string) (*models.DockerManifest, error)
- func (m *BaseMockDB) GetDockerTag(ctx context.Context, repoID, image, name string) (*models.DockerTag, error)
- func (m *BaseMockDB) GetDockerUpload(ctx context.Context, repositoryID, uploadUUID string) (*models.DockerUpload, error)
- func (m *BaseMockDB) GetGoModule(ctx context.Context, repoID, modulePath, version string) (*models.GoModule, error)
- func (m *BaseMockDB) GetGroupByID(ctx context.Context, id string) (*models.Group, error)
- func (m *BaseMockDB) GetGroupByName(ctx context.Context, name string) (*models.Group, error)
- func (m *BaseMockDB) GetHelmChart(ctx context.Context, repoID, name, version string) (*models.HelmChart, error)
- func (m *BaseMockDB) GetIvyArtifact(ctx context.Context, ...) (*models.IvyArtifact, error)
- func (m *BaseMockDB) GetLatestSnapshot(ctx context.Context, repoID, groupID, artifactID, version string) (*models.MavenArtifact, error)
- func (m *BaseMockDB) GetLatestSnapshotFile(ctx context.Context, ...) (*models.MavenArtifact, error)
- func (m *BaseMockDB) GetLicensePolicy(ctx context.Context, id string) (*models.LicensePolicy, error)
- func (m *BaseMockDB) GetLicenseScanResult(ctx context.Context, repoID, artifactID string) (*models.LicenseScanResult, error)
- func (m *BaseMockDB) GetLicenseScanResultByID(ctx context.Context, repoID, id string) (*models.LicenseScanResult, error)
- func (m *BaseMockDB) GetMavenArtifactByPath(ctx context.Context, repoID, path string) (*models.MavenArtifact, error)
- func (m *BaseMockDB) GetMavenArtifactsByGA(ctx context.Context, repoID, groupID, artifactID string) ([]*models.MavenArtifact, error)
- func (m *BaseMockDB) GetMavenArtifactsByGAV(ctx context.Context, repoID, groupID, artifactID, version string) ([]*models.MavenArtifact, error)
- func (m *BaseMockDB) GetNPMDistTags(ctx context.Context, packageID string) (map[string]string, error)
- func (m *BaseMockDB) GetNPMPackageByName(ctx context.Context, repoID, fullName string) (*models.NPMPackage, error)
- func (m *BaseMockDB) GetNPMVersion(ctx context.Context, packageID, version string) (*models.NPMVersion, error)
- func (m *BaseMockDB) GetNPMVersionStates(ctx context.Context, packageID string) ([]models.NPMVersionState, error)
- func (m *BaseMockDB) GetNPMVersionsByPackage(ctx context.Context, packageID string) ([]*models.NPMVersion, error)
- func (m *BaseMockDB) GetNuGetPackage(ctx context.Context, repoID, packageID, version string) (*models.NuGetPackage, error)
- func (m *BaseMockDB) GetOrCreateDebianArchitecture(ctx context.Context, distID, name string) (*models.DebianArchitecture, error)
- func (m *BaseMockDB) GetOrCreateDebianComponent(ctx context.Context, distID, name string) (*models.DebianComponent, error)
- func (m *BaseMockDB) GetOrCreateDebianDistribution(ctx context.Context, repoID, name string) (*models.DebianDistribution, error)
- func (m *BaseMockDB) GetOrCreateGroup(ctx context.Context, name string) (*models.Group, error)
- func (m *BaseMockDB) GetOrCreatePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
- func (m *BaseMockDB) GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
- func (m *BaseMockDB) GetPackageDelta(ctx context.Context, repoID, fromSHA256, toSHA256 string) (*models.PackageDelta, error)
- func (m *BaseMockDB) GetPermissionTargetByID(ctx context.Context, id string) (*models.PermissionTarget, error)
- func (m *BaseMockDB) GetPermissionTargetByName(ctx context.Context, name string) (*models.PermissionTarget, error)
- func (m *BaseMockDB) GetPermissionTargetsForPrincipal(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
- func (m *BaseMockDB) GetPresignedUpload(ctx context.Context, repoID, id string) (*models.PresignedUpload, error)
- func (m *BaseMockDB) GetProject(ctx context.Context, id string) (*models.Project, error)
- func (m *BaseMockDB) GetProjectByName(ctx context.Context, name string) (*models.Project, error)
- func (m *BaseMockDB) GetProjectGroup(ctx context.Context, projectID, groupID string) (*models.ProjectGroup, error)
- func (m *BaseMockDB) GetProjectMember(ctx context.Context, projectID, userID string) (*models.ProjectMember, error)
- func (m *BaseMockDB) GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
- func (m *BaseMockDB) GetProjectUsage(ctx context.Context, projectID string) (*models.ProjectUsage, error)
- func (m *BaseMockDB) GetPromotionPipelineByID(ctx context.Context, id string) (*models.PromotionPipeline, error)
- func (m *BaseMockDB) GetPromotionPipelineByName(ctx context.Context, name string) (*models.PromotionPipeline, error)
- func (m *BaseMockDB) GetProxyCacheEntry(ctx context.Context, repoID, cacheKey string) (*models.ProxyCacheEntry, error)
- func (m *BaseMockDB) GetPyPIPackage(ctx context.Context, repoID, name, version, filename string) (*models.PyPIPackage, error)
- func (m *BaseMockDB) GetPyPIPackageByFilename(ctx context.Context, repoID, filename string) (*models.PyPIPackage, error)
- func (m *BaseMockDB) GetRPMRepo(ctx context.Context, repositoryID string) (*models.RPMRepo, error)
- func (m *BaseMockDB) GetRawArtifact(ctx context.Context, repoID, path string) (*models.RawArtifact, error)
- func (m *BaseMockDB) GetReleaseBundle(ctx context.Context, name, version string) (*models.ReleaseBundle, error)
- func (m *BaseMockDB) GetReleaseBundleByID(ctx context.Context, id string) (*models.ReleaseBundle, error)
- func (m *BaseMockDB) GetRepoComponentBlob(ctx context.Context, repoID, id string) (*models.ComponentBlob, error)
- func (m *BaseMockDB) GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
- func (m *BaseMockDB) GetRepoMetadataByRepo(ctx context.Context, repositoryID string) ([]models.RepoMetadata, error)
- func (m *BaseMockDB) GetRepositoryByID(ctx context.Context, id string) (*models.Repository, error)
- func (m *BaseMockDB) GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
- func (m *BaseMockDB) GetRpmPackageByID(ctx context.Context, id string) (*models.RpmPackage, error)
- func (m *BaseMockDB) GetRubyGem(ctx context.Context, repoID, name, version, platform string) (*models.RubyGem, error)
- func (m *BaseMockDB) GetSBOMReport(ctx context.Context, repoID, artifactID, format, specVersion string) (*models.SBOMReport, error)
- func (m *BaseMockDB) GetSBOMReportByID(ctx context.Context, repoID, id string) (*models.SBOMReport, error)
- func (m *BaseMockDB) GetSBTArtifact(ctx context.Context, repoID, groupID, artifactID, version, filename string) (*models.SBTArtifact, error)
- func (m *BaseMockDB) GetSSOProviderByID(ctx context.Context, id string) (*models.SSOProvider, error)
- func (m *BaseMockDB) GetSSOProviderBySlug(ctx context.Context, slug string) (*models.SSOProvider, error)
- func (m *BaseMockDB) GetSecretScanResult(ctx context.Context, repoID, artifactID string) (*models.SecretScanResult, error)
- func (m *BaseMockDB) GetSessionByTokenHash(ctx context.Context, hash string) (*models.Session, error)
- func (m *BaseMockDB) GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
- func (m *BaseMockDB) GetSystemSetting(ctx context.Context, key string) (string, error)
- func (m *BaseMockDB) GetTokenByHash(ctx context.Context, hash string) (*models.Token, error)
- func (m *BaseMockDB) GetTokenByID(ctx context.Context, tokenID string) (*models.Token, error)
- func (m *BaseMockDB) GetUserByEmail(ctx context.Context, email string) (*models.User, error)
- func (m *BaseMockDB) GetUserByExternalID(ctx context.Context, externalID, providerSlug string) (*models.User, error)
- func (m *BaseMockDB) GetUserByID(ctx context.Context, id string) (*models.User, error)
- func (m *BaseMockDB) GetUserByUsername(ctx context.Context, username string) (*models.User, error)
- func (m *BaseMockDB) GetVulnScanResult(ctx context.Context, repoID, artifactID string) (*models.VulnScanResult, error)
- func (m *BaseMockDB) GetVulnScanResultByID(ctx context.Context, repoID, id string) (*models.VulnScanResult, error)
- func (m *BaseMockDB) GetWebhook(ctx context.Context, id string) (*models.Webhook, error)
- func (m *BaseMockDB) HelmIndexStamp(ctx context.Context, repoID string) (string, error)
- func (m *BaseMockDB) IncrementCargoDownloadCount(ctx context.Context, repoID, name, version string) error
- func (m *BaseMockDB) IncrementNuGetDownloadCount(ctx context.Context, repoID, packageID, version string) error
- func (m *BaseMockDB) IncrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
- func (m *BaseMockDB) InsertAuditLog(ctx context.Context, event *models.AuditLog) error
- func (m *BaseMockDB) ListAIAnalyses(ctx context.Context, repoID string, status string, licenseReviewOnly bool, ...) ([]*models.AIAnalysis, int, error)
- func (m *BaseMockDB) ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
- func (m *BaseMockDB) ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
- func (m *BaseMockDB) ListAllProjects(ctx context.Context) ([]*models.Project, error)
- func (m *BaseMockDB) ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
- func (m *BaseMockDB) ListAllTokens(ctx context.Context, page, perPage int) ([]*models.Token, int, error)
- func (m *BaseMockDB) ListArtifactProperties(ctx context.Context, repoID, artifactID string) (map[string]string, error)
- func (m *BaseMockDB) ListAuditLogs(ctx context.Context, params models.AuditListParams) (*models.AuditPage, error)
- func (m *BaseMockDB) ListBackupJobs(ctx context.Context, limit int) ([]*models.BackupJob, error)
- func (m *BaseMockDB) ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
- func (m *BaseMockDB) ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
- func (m *BaseMockDB) ListCargoCrateVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
- func (m *BaseMockDB) ListCargoIndexVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
- func (m *BaseMockDB) ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
- func (m *BaseMockDB) ListComponentsByRepo(ctx context.Context, repoID, formatFilter string, page, limit int) ([]*models.Component, int, error)
- func (m *BaseMockDB) ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
- func (m *BaseMockDB) ListConanRecipeFiles(ctx context.Context, repoID, name, version, userChannel string) ([]*models.ConanPackage, error)
- func (m *BaseMockDB) ListConanRecipes(ctx context.Context, repoID string) ([]models.ConanRecipe, error)
- func (m *BaseMockDB) ListCondaPackages(ctx context.Context, repoID, platform string) ([]*models.CondaPackage, error)
- func (m *BaseMockDB) ListDebPackageEntries(ctx context.Context, repoID, dist, comp, arch string) ([]models.DebPackageEntry, error)
- func (m *BaseMockDB) ListDebPackagesByRepo(ctx context.Context, repoID string) ([]*models.DebPackage, error)
- func (m *BaseMockDB) ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
- func (m *BaseMockDB) ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
- func (m *BaseMockDB) ListDockerManifestsBySubject(ctx context.Context, repoID, image, subjectDigest string) ([]*models.DockerManifest, error)
- func (m *BaseMockDB) ListDockerTags(ctx context.Context, repoID, image, last string, n int) ([]*models.DockerTag, error)
- func (m *BaseMockDB) ListDockerTagsByRepo(ctx context.Context, repoID string, limit int) ([]*models.DockerTag, error)
- func (m *BaseMockDB) ListEnabledCleanupPolicies(ctx context.Context) ([]*models.CleanupPolicy, error)
- func (m *BaseMockDB) ListEnabledSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
- func (m *BaseMockDB) ListExpiredPresignedUploads(ctx context.Context, limit int) ([]string, error)
- func (m *BaseMockDB) ListGlobalLicensePolicies(ctx context.Context) ([]*models.LicensePolicy, error)
- func (m *BaseMockDB) ListGoModuleVersions(ctx context.Context, repoID, modulePath string) ([]*models.GoModule, error)
- func (m *BaseMockDB) ListGoModulesByRepo(ctx context.Context, repoID string) ([]*models.GoModule, error)
- func (m *BaseMockDB) ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
- func (m *BaseMockDB) ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
- func (m *BaseMockDB) ListGroups(ctx context.Context) ([]*models.Group, error)
- func (m *BaseMockDB) ListGroupsByUser(ctx context.Context, userID string) ([]*models.Group, error)
- func (m *BaseMockDB) ListHelmChartVersions(ctx context.Context, repoID, name string) ([]*models.HelmChart, error)
- func (m *BaseMockDB) ListHelmCharts(ctx context.Context, repoID string) ([]*models.HelmChart, error)
- func (m *BaseMockDB) ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
- func (m *BaseMockDB) ListLicensePolicies(ctx context.Context, repoID string) ([]*models.LicensePolicy, error)
- func (m *BaseMockDB) ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
- func (m *BaseMockDB) ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
- func (m *BaseMockDB) ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
- func (m *BaseMockDB) ListNuGetPackageVersions(ctx context.Context, repoID, packageID string) ([]*models.NuGetPackage, error)
- func (m *BaseMockDB) ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
- func (m *BaseMockDB) ListPackageDeltas(ctx context.Context, repoID, toSHA256 string) ([]*models.PackageDelta, error)
- func (m *BaseMockDB) ListPendingAIAnalyses(ctx context.Context, limit int) ([]*models.AIAnalysis, error)
- func (m *BaseMockDB) ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
- func (m *BaseMockDB) ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
- func (m *BaseMockDB) ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
- func (m *BaseMockDB) ListProjectCleanupRepositories(ctx context.Context, projectID string) ([]string, error)
- func (m *BaseMockDB) ListProjectGrantsByUser(ctx context.Context, userID string) ([]*models.ProjectGrant, error)
- func (m *BaseMockDB) ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
- func (m *BaseMockDB) ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
- func (m *BaseMockDB) ListProjectRepositories(ctx context.Context, projectID string, page, limit int) ([]*models.Repository, int, error)
- func (m *BaseMockDB) ListProjectTokens(ctx context.Context, projectID string, createdBy *string) ([]*models.Token, error)
- func (m *BaseMockDB) ListProjects(ctx context.Context, userID string) ([]*models.Project, error)
- func (m *BaseMockDB) ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
- func (m *BaseMockDB) ListPublicRepositoryNames(ctx context.Context) ([]string, error)
- func (m *BaseMockDB) ListPyPIPackageNames(ctx context.Context, repoID string) ([]string, error)
- func (m *BaseMockDB) ListPyPIPackageVersions(ctx context.Context, repoID, name string) ([]*models.PyPIPackage, error)
- func (m *BaseMockDB) ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
- func (m *BaseMockDB) ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
- func (m *BaseMockDB) ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
- func (m *BaseMockDB) ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
- func (m *BaseMockDB) ListRpmPackagesByRepo(ctx context.Context, repoID string) ([]*models.RpmPackage, error)
- func (m *BaseMockDB) ListRpmPackagesForMetadata(ctx context.Context, repoID string) ([]pkgrpm.Package, error)
- func (m *BaseMockDB) ListRubyGemSpecs(ctx context.Context, repoID string) ([]*models.RubyGem, error)
- func (m *BaseMockDB) ListRubyGemVersions(ctx context.Context, repoID, name string) ([]*models.RubyGem, error)
- func (m *BaseMockDB) ListRubyGems(ctx context.Context, repoID string) ([]*models.RubyGem, error)
- func (m *BaseMockDB) ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
- func (m *BaseMockDB) ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
- func (m *BaseMockDB) ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
- func (m *BaseMockDB) ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
- func (m *BaseMockDB) ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
- func (m *BaseMockDB) ListTokensByUser(ctx context.Context, userID string) ([]*models.Token, error)
- func (m *BaseMockDB) ListUserGroupMemberships(ctx context.Context) ([]*models.UserGroup, error)
- func (m *BaseMockDB) ListUsers(ctx context.Context, page, perPage int) ([]*models.User, int, error)
- func (m *BaseMockDB) ListUsersByGroup(ctx context.Context, groupID string) ([]*models.User, error)
- func (m *BaseMockDB) ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
- func (m *BaseMockDB) ListVulnScanOverview(ctx context.Context, params models.VulnScanListParams) (*models.VulnScanOverviewPage, error)
- func (m *BaseMockDB) ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
- func (m *BaseMockDB) ListWebhookDeliveries(ctx context.Context, webhookID string, limit int) ([]*models.WebhookDelivery, error)
- func (m *BaseMockDB) ListWebhooks(ctx context.Context, repoID string) ([]*models.Webhook, error)
- func (m *BaseMockDB) ListWebhooksForEvent(ctx context.Context, repoID, eventType string) ([]*models.Webhook, error)
- func (m *BaseMockDB) MarkPackumentStale(ctx context.Context, packageID string) error
- func (m *BaseMockDB) MarkPresignedUploadCompleted(ctx context.Context, id, artifactID string) error
- func (m *BaseMockDB) MarkRepoStale(ctx context.Context, repositoryID string) error
- func (m *BaseMockDB) Migrate(ctx context.Context) error
- func (m *BaseMockDB) MoveRepositoryToProject(ctx context.Context, repoID, toProjectID string, maxRepositories int) error
- func (m *BaseMockDB) Ping(ctx context.Context) error
- func (m *BaseMockDB) QuarantineArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
- func (m *BaseMockDB) QuarantineVulnArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
- func (m *BaseMockDB) ReconcileAllStorageUsage(ctx context.Context) (int64, error)
- func (m *BaseMockDB) ReconcileStorageUsage(ctx context.Context, repoID string) (*models.StorageQuota, error)
- func (m *BaseMockDB) ReleasePresignedUpload(ctx context.Context, id string) error
- func (m *BaseMockDB) RemoveBundleItem(ctx context.Context, bundleID, sha256 string) error
- func (m *BaseMockDB) RemoveGroupMember(ctx context.Context, groupRepoID, memberRepoID string) error
- func (m *BaseMockDB) RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
- func (m *BaseMockDB) RepairBootstrapAdmin(ctx context.Context, username string) (bool, error)
- func (m *BaseMockDB) ReplaceGroupMembers(ctx context.Context, groupRepoID string, memberIDs []string) error
- func (m *BaseMockDB) ReserveStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) (bool, error)
- func (m *BaseMockDB) RevokeProjectToken(ctx context.Context, projectID, tokenID string) (bool, error)
- func (m *BaseMockDB) RevokeToken(ctx context.Context, tokenID string) error
- func (m *BaseMockDB) RpmPackageExists(ctx context.Context, repoID, name, version, release string, epoch int, ...) (bool, error)
- func (m *BaseMockDB) RubyGemsSpecsStamp(ctx context.Context, repoID string) (string, error)
- func (m *BaseMockDB) SealReleaseBundle(ctx context.Context, bundleID, sealedBy string, sealedAt time.Time) (bool, error)
- func (m *BaseMockDB) SearchByProperty(ctx context.Context, repoID, key, value string) ([]string, error)
- func (m *BaseMockDB) SearchCargoCrateSummaries(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrateSummary, int, error)
- func (m *BaseMockDB) SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
- func (m *BaseMockDB) SearchNuGetPackages(ctx context.Context, repoID, query string, skip, take int) ([]*models.NuGetPackage, int, error)
- func (m *BaseMockDB) SearchRubyGems(ctx context.Context, repoID, query string) ([]*models.RubyGem, error)
- func (m *BaseMockDB) SetArtifactProperties(ctx context.Context, repoID, artifactID string, props map[string]string, ...) error
- func (m *BaseMockDB) SetArtifactProperty(ctx context.Context, repoID, artifactID, key, value string) error
- func (m *BaseMockDB) SetDebControlFields(ctx context.Context, packageID, maintainer, homepage string, ...) error
- func (m *BaseMockDB) SetLicenseScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
- func (m *BaseMockDB) SetNuGetDependencyGroups(ctx context.Context, repoID, packageID, version string, groups []byte) error
- func (m *BaseMockDB) SetProjectGroup(ctx context.Context, projectID, groupID, role string, createdBy *string) error
- func (m *BaseMockDB) SetProjectQuota(ctx context.Context, projectID string, maxSizeBytes, maxArtifactCount int64, ...) (*models.ProjectQuota, error)
- func (m *BaseMockDB) SetSystemSetting(ctx context.Context, key, value string) error
- func (m *BaseMockDB) SetVulnScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
- func (m *BaseMockDB) StorageBackendBusyReason(ctx context.Context, backendID string) (string, error)
- func (m *BaseMockDB) SyncSSOGroups(ctx context.Context, userID string, groupIDs []string) error
- func (m *BaseMockDB) SyncSSOPermissionsForGroup(ctx context.Context, groupID string, targetIDs []string) error
- func (m *BaseMockDB) UpdateBackupJob(ctx context.Context, job *models.BackupJob) error
- func (m *BaseMockDB) UpdateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
- func (m *BaseMockDB) UpdateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
- func (m *BaseMockDB) UpdateCleanupPolicyRunResult(ctx context.Context, id string, deletedCount int, runErr error) error
- func (m *BaseMockDB) UpdateDockerUploadOffset(ctx context.Context, repositoryID, uploadUUID string, ...) (bool, error)
- func (m *BaseMockDB) UpdateGroup(ctx context.Context, group *models.Group) error
- func (m *BaseMockDB) UpdateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
- func (m *BaseMockDB) UpdateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
- func (m *BaseMockDB) UpdateNPMPackageLatestVersion(ctx context.Context, packageID, latestVersion string) error
- func (m *BaseMockDB) UpdateNPMVersionManifest(ctx context.Context, packageID, version string, manifest []byte) error
- func (m *BaseMockDB) UpdatePermissionTarget(ctx context.Context, target *models.PermissionTarget) error
- func (m *BaseMockDB) UpdateProject(ctx context.Context, project *models.Project) error
- func (m *BaseMockDB) UpdatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
- func (m *BaseMockDB) UpdateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
- func (m *BaseMockDB) UpdateRepository(ctx context.Context, repo *models.Repository) error
- func (m *BaseMockDB) UpdateRepositoryAndMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
- func (m *BaseMockDB) UpdateRpmPackageExtra(ctx context.Context, repoID, sha256 string, extra []byte) error
- func (m *BaseMockDB) UpdateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
- func (m *BaseMockDB) UpdateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
- func (m *BaseMockDB) UpdateSessionLastSeen(ctx context.Context, sessionID string, expiresAt time.Time) error
- func (m *BaseMockDB) UpdateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
- func (m *BaseMockDB) UpdateStorageBackendStatus(ctx context.Context, id, status string, message *string) error
- func (m *BaseMockDB) UpdateStorageQuota(ctx context.Context, quota *models.StorageQuota) error
- func (m *BaseMockDB) UpdateTokenLastUsed(ctx context.Context, tokenID string) error
- func (m *BaseMockDB) UpdateUser(ctx context.Context, user *models.User) error
- func (m *BaseMockDB) UpdateUserLastLogin(ctx context.Context, id string, at time.Time) error
- func (m *BaseMockDB) UpdateUserPassword(ctx context.Context, id, passwordHash string, mustChange bool) error
- func (m *BaseMockDB) UpdateUserSSO(ctx context.Context, userID string, externalID, providerSlug string) error
- func (m *BaseMockDB) UpdateUserSSOProfile(ctx context.Context, id string, email, fullName *string, lastLogin time.Time) error
- func (m *BaseMockDB) UpdateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
- func (m *BaseMockDB) UpdateWebhook(ctx context.Context, wh *models.Webhook) error
- func (m *BaseMockDB) UpdateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
- func (m *BaseMockDB) UpsertAIAnalysis(ctx context.Context, analysis *models.AIAnalysis) error
- func (m *BaseMockDB) UpsertBlob(ctx context.Context, sha256, blobKey string, sizeBytes int64) (string, error)
- func (m *BaseMockDB) UpsertDockerTag(ctx context.Context, tag *models.DockerTag) error
- func (m *BaseMockDB) UpsertNPMDistTag(ctx context.Context, t *models.NPMDistTag) (*models.NPMDistTag, error)
- func (m *BaseMockDB) UpsertProxyCacheEntry(ctx context.Context, entry *models.ProxyCacheEntry) error
- func (m *BaseMockDB) UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
- func (m *BaseMockDB) UpsertRepoMetadata(ctx context.Context, meta *models.RepoMetadata) error
- func (m *BaseMockDB) UpsertVEXStatement(ctx context.Context, s *models.VEXStatement) error
- func (m *BaseMockDB) VulnScanOverviewSummary(ctx context.Context, repoName string) (*models.VulnScanSummary, error)
- func (m *BaseMockDB) YankCargoCrate(ctx context.Context, repoID, name, version string, yanked bool) error
- func (m *BaseMockDB) YankRubyGem(ctx context.Context, repoID, name, version, platform string, yanked bool) error
- type BlobDeletion
- type BlobDeletionStore
- type BlobRow
- type ComponentListOptions
- type ComponentSearcher
- type Database
- type DatabaseConfig
- type DockerBlobImages
- type DockerBlobToucher
- type DockerGCStore
- type DockerUploadSweepStore
- type GomodAffectedRow
- type LiveSnapshot
- type MigrationStatus
- type Migrator
- type PostgresDB
- func (p *PostgresDB) AddBundleItem(ctx context.Context, item *models.ReleaseBundleItem) error
- func (p *PostgresDB) AddBundleItems(ctx context.Context, bundleID string, items []*models.ReleaseBundleItem) error
- func (p *PostgresDB) AddGroupMember(ctx context.Context, groupRepoID, memberRepoID string, priority int) error
- func (p *PostgresDB) AddProjectMember(ctx context.Context, projectID, userID, role string) error
- func (p *PostgresDB) AddUserToGroup(ctx context.Context, userID, groupID string) error
- func (p *PostgresDB) ArtifactExists(ctx context.Context, sha256 string, repositoryID string) (bool, error)
- func (p *PostgresDB) ArtifactExistsBySHA256(ctx context.Context, sha256 string) (string, bool, error)
- func (p *PostgresDB) AuthCacheGeneration() uint64
- func (p *PostgresDB) AuthCacheTTL() time.Duration
- func (p *PostgresDB) BeginBackupSnapshot(ctx context.Context, leaseTTL time.Duration) (SnapshotReader, error)
- func (p *PostgresDB) BeginStorageTierMove(ctx context.Context, m *models.StorageTierMove) (*models.StorageTierMove, bool, error)
- func (p *PostgresDB) BeginTx(ctx context.Context) (Transaction, error)
- func (p *PostgresDB) BlobDeletionDue(ctx context.Context, sha256, scope string) (bool, error)
- func (p *PostgresDB) BlobReferenceCount(ctx context.Context, sha256 string) (int, error)
- func (p *PostgresDB) BlobRowExists(ctx context.Context, sha256 string) (bool, error)
- func (p *PostgresDB) CargoIndexStamp(ctx context.Context, repoID, name string) (string, error)
- func (p *PostgresDB) ChangeProjectGroup(ctx context.Context, projectID, groupID, newRole string, createdBy *string, ...) error
- func (p *PostgresDB) ChangeProjectMember(ctx context.Context, projectID, userID, newRole string, guard ProjectRoleGuard) error
- func (p *PostgresDB) ClaimBlobDeletions(ctx context.Context, limit int, claimFor time.Duration) ([]BlobDeletion, error)
- func (p *PostgresDB) ClaimPendingWebhookDeliveries(ctx context.Context, limit int, lease time.Duration) ([]*models.WebhookDelivery, error)
- func (p *PostgresDB) ClaimPresignedUpload(ctx context.Context, repoID, id string, lease time.Duration) (bool, error)
- func (p *PostgresDB) Close() error
- func (p *PostgresDB) CondaRepodataStamp(ctx context.Context, repoID, platform string) (string, error)
- func (p *PostgresDB) ConsumeSAMLAssertion(ctx context.Context, providerSlug, assertionID string, expiresAt time.Time) (bool, error)
- func (p *PostgresDB) CountBlobDeletions(ctx context.Context) (int64, error)
- func (p *PostgresDB) CountBlobsOnStorageBackend(ctx context.Context, backendID string) (int64, error)
- func (p *PostgresDB) CountRepositories(ctx context.Context, formatFilter string) (int, error)
- func (p *PostgresDB) CountRepositoriesByProject(ctx context.Context, projectIDs []string) (map[string]int, error)
- func (p *PostgresDB) CountStorageTierMoves(ctx context.Context) (int64, error)
- func (p *PostgresDB) CountUsers(ctx context.Context) (int, error)
- func (p *PostgresDB) CreateBackupJob(ctx context.Context, job *models.BackupJob) error
- func (p *PostgresDB) CreateBootstrapAdmin(ctx context.Context, username, passwordHash string) (bool, error)
- func (p *PostgresDB) CreateBundlePromotion(ctx context.Context, pr *models.BundlePromotion) error
- func (p *PostgresDB) CreateCargoCrate(ctx context.Context, crate *models.CargoCrate) error
- func (p *PostgresDB) CreateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
- func (p *PostgresDB) CreateComponent(ctx context.Context, component *models.Component) error
- func (p *PostgresDB) CreateConanPackage(ctx context.Context, pkg *models.ConanPackage) error
- func (p *PostgresDB) CreateCondaPackage(ctx context.Context, pkg *models.CondaPackage) error
- func (p *PostgresDB) CreateDebPackage(ctx context.Context, pkg *models.Component, distID, compID string) error
- func (p *PostgresDB) CreateDebianArchitecture(ctx context.Context, arch *models.DebianArchitecture) error
- func (p *PostgresDB) CreateDebianComponent(ctx context.Context, comp *models.DebianComponent) error
- func (p *PostgresDB) CreateDebianDistribution(ctx context.Context, dist *models.DebianDistribution) error
- func (p *PostgresDB) CreateDockerBlob(ctx context.Context, blob *models.DockerBlob) error
- func (p *PostgresDB) CreateDockerManifest(ctx context.Context, m *models.DockerManifest) error
- func (p *PostgresDB) CreateDockerUpload(ctx context.Context, upload *models.DockerUpload) error
- func (p *PostgresDB) CreateGoModule(ctx context.Context, mod *models.GoModule) error
- func (p *PostgresDB) CreateGroup(ctx context.Context, group *models.Group) (*models.Group, error)
- func (p *PostgresDB) CreateHelmChart(ctx context.Context, chart *models.HelmChart) error
- func (p *PostgresDB) CreateIvyArtifact(ctx context.Context, artifact *models.IvyArtifact) error
- func (p *PostgresDB) CreateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
- func (p *PostgresDB) CreateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
- func (p *PostgresDB) CreateMavenArtifact(ctx context.Context, a *models.MavenArtifact) error
- func (p *PostgresDB) CreateNPMPackage(ctx context.Context, pkg *models.NPMPackage) (*models.NPMPackage, error)
- func (p *PostgresDB) CreateNPMVersion(ctx context.Context, v *models.NPMVersion) (*models.NPMVersion, error)
- func (p *PostgresDB) CreateNuGetPackage(ctx context.Context, pkg *models.NuGetPackage) error
- func (p *PostgresDB) CreatePackageDelta(ctx context.Context, d *models.PackageDelta) error
- func (p *PostgresDB) CreatePermissionAssignment(ctx context.Context, assignment *models.PermissionAssignment) error
- func (p *PostgresDB) CreatePermissionTarget(ctx context.Context, target *models.PermissionTarget) (*models.PermissionTarget, error)
- func (p *PostgresDB) CreatePresignedUpload(ctx context.Context, u *models.PresignedUpload) error
- func (p *PostgresDB) CreatePresignedUploadCapped(ctx context.Context, u *models.PresignedUpload, maxPending int) error
- func (p *PostgresDB) CreateProject(ctx context.Context, project *models.Project) error
- func (p *PostgresDB) CreateProjectRepository(ctx context.Context, repo *models.Repository, memberIDs []string, ...) error
- func (p *PostgresDB) CreateProjectToken(ctx context.Context, spec ProjectTokenSpec) (*models.Token, error)
- func (p *PostgresDB) CreatePromotionPipeline(ctx context.Context, pp *models.PromotionPipeline) error
- func (p *PostgresDB) CreatePyPIPackage(ctx context.Context, pkg *models.PyPIPackage) error
- func (p *PostgresDB) CreateRPMRepo(ctx context.Context, repo *models.RPMRepo) error
- func (p *PostgresDB) CreateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
- func (p *PostgresDB) CreateRepository(ctx context.Context, repo *models.Repository) error
- func (p *PostgresDB) CreateRepositoryWithMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
- func (p *PostgresDB) CreateRpmPackage(ctx context.Context, pkg *models.Component) error
- func (p *PostgresDB) CreateRubyGem(ctx context.Context, gem *models.RubyGem) error
- func (p *PostgresDB) CreateSBOMReport(ctx context.Context, report *models.SBOMReport) error
- func (p *PostgresDB) CreateSBTArtifact(ctx context.Context, artifact *models.SBTArtifact) error
- func (p *PostgresDB) CreateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
- func (p *PostgresDB) CreateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
- func (p *PostgresDB) CreateSession(ctx context.Context, session *models.Session) (*models.Session, error)
- func (p *PostgresDB) CreateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
- func (p *PostgresDB) CreateStoragePolicy(ctx context.Context, pol *models.StoragePolicy) error
- func (p *PostgresDB) CreateStorageTier(ctx context.Context, t *models.StorageTier) error
- func (p *PostgresDB) CreateToken(ctx context.Context, token *models.Token) (*models.Token, error)
- func (p *PostgresDB) CreateUser(ctx context.Context, user *models.User) (*models.User, error)
- func (p *PostgresDB) CreateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
- func (p *PostgresDB) CreateWebhook(ctx context.Context, wh *models.Webhook) error
- func (p *PostgresDB) CreateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
- func (p *PostgresDB) DecrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
- func (p *PostgresDB) DeleteAIAnalysis(ctx context.Context, repoID, artifactID string) error
- func (p *PostgresDB) DeleteArtifactProperty(ctx context.Context, repoID, artifactID, key string) error
- func (p *PostgresDB) DeleteBlobDeletion(ctx context.Context, sha256, scope string) error
- func (p *PostgresDB) DeleteBlobIfUnreferenced(ctx context.Context, sha256 string) (bool, error)
- func (p *PostgresDB) DeleteCargoCrate(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteCleanupPolicy(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteComponent(ctx context.Context, componentID string) error
- func (p *PostgresDB) DeleteConanPackage(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteCondaPackage(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteDockerBlob(ctx context.Context, repoID, digest string) error
- func (p *PostgresDB) DeleteDockerBlobsForGC(ctx context.Context, repoID string, digests []string, grace time.Duration) ([]*models.DockerGCBlob, error)
- func (p *PostgresDB) DeleteDockerManifest(ctx context.Context, repoID, image, digest string) error
- func (p *PostgresDB) DeleteDockerManifestsForGC(ctx context.Context, repoID string, ids []string, grace time.Duration) ([]*models.DockerGCManifest, error)
- func (p *PostgresDB) DeleteDockerTag(ctx context.Context, repoID, image, name string) error
- func (p *PostgresDB) DeleteDockerTagsByDigest(ctx context.Context, repoID, image, digest string) error
- func (p *PostgresDB) DeleteDockerUpload(ctx context.Context, repositoryID, uploadUUID string) error
- func (p *PostgresDB) DeleteExpiredProxyCacheEntries(ctx context.Context) (int64, error)
- func (p *PostgresDB) DeleteGoModule(ctx context.Context, repoID, modulePath, version string) error
- func (p *PostgresDB) DeleteGroup(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteHelmChart(ctx context.Context, repoID, name, version string) error
- func (p *PostgresDB) DeleteIvyArtifact(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteLicensePolicy(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteMavenArtifact(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteNPMDistTag(ctx context.Context, packageID, tag string) error
- func (p *PostgresDB) DeleteNPMPackage(ctx context.Context, packageID string) error
- func (p *PostgresDB) DeleteNPMVersion(ctx context.Context, packageID, version string) error
- func (p *PostgresDB) DeleteNuGetPackage(ctx context.Context, repoID, packageID, version string) error
- func (p *PostgresDB) DeleteOtherSessionsByUser(ctx context.Context, userID, keepTokenHash string) error
- func (p *PostgresDB) DeletePackageDelta(ctx context.Context, id string) error
- func (p *PostgresDB) DeletePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
- func (p *PostgresDB) DeletePermissionTarget(ctx context.Context, id string) error
- func (p *PostgresDB) DeletePresignedUpload(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteProject(ctx context.Context, id string) error
- func (p *PostgresDB) DeletePromotionPipeline(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteProxyCacheEntry(ctx context.Context, repoID, cacheKey string) error
- func (p *PostgresDB) DeletePyPIPackage(ctx context.Context, repoID, name, version, filename string) error
- func (p *PostgresDB) DeleteRawArtifact(ctx context.Context, repoID, path string) error
- func (p *PostgresDB) DeleteReleaseBundle(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteRepository(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteRubyGem(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteSBOMReport(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteSBOMReportInRepo(ctx context.Context, repoID, id string) (string, error)
- func (p *PostgresDB) DeleteSBTArtifact(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteSSOProvider(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteSession(ctx context.Context, tokenHash string) error
- func (p *PostgresDB) DeleteSessionsByUser(ctx context.Context, userID string) error
- func (p *PostgresDB) DeleteStaleDockerUploads(ctx context.Context, cutoff time.Time) ([]string, error)
- func (p *PostgresDB) DeleteStorageBackend(ctx context.Context, id string) error
- func (p *PostgresDB) DeleteStoragePolicy(ctx context.Context, id string) (bool, error)
- func (p *PostgresDB) DeleteStorageTierIfUnused(ctx context.Context, tierID string) (string, error)
- func (p *PostgresDB) DeleteUnreferencedInvalidBlobRow(ctx context.Context, id string) (bool, error)
- func (p *PostgresDB) DeleteVEXStatement(ctx context.Context, repoID, id string) error
- func (p *PostgresDB) DeleteVulnScanResult(ctx context.Context, repoID, id string) error
- func (p *PostgresDB) DeleteWebhook(ctx context.Context, id string) error
- func (p *PostgresDB) DockerBlobVisible(ctx context.Context, repoID, image, digest string) (bool, error)
- func (p *PostgresDB) EmptySHA256BlobID(ctx context.Context) (string, error)
- func (p *PostgresDB) EnqueueBlobDeletion(ctx context.Context, sha256, scope string) error
- func (p *PostgresDB) EnsureBlob(ctx context.Context, sha256, mediaType string, size int64) (string, error)
- func (p *PostgresDB) ExistingPresignedUploadIDs(ctx context.Context, ids []string) ([]string, error)
- func (p *PostgresDB) FailStorageTierMove(ctx context.Context, sha256, message string) error
- func (p *PostgresDB) FinishStorageTierMove(ctx context.Context, sha256 string) error
- func (p *PostgresDB) FlipBlobPlacement(ctx context.Context, sha256, from, to string, ...) (models.FlipOutcome, error)
- func (p *PostgresDB) GetAIAnalysis(ctx context.Context, repoID, artifactID string) (*models.AIAnalysis, error)
- func (p *PostgresDB) GetArtifactProperty(ctx context.Context, repoID, artifactID, key string) (string, error)
- func (p *PostgresDB) GetBackupJob(ctx context.Context, id string) (*models.BackupJob, error)
- func (p *PostgresDB) GetBlobPlacement(ctx context.Context, sha256 string) (string, int64, bool, error)
- func (p *PostgresDB) GetBundleItem(ctx context.Context, bundleID, sha256 string) (*models.ReleaseBundleItem, error)
- func (p *PostgresDB) GetCargoCrate(ctx context.Context, repoID, name, version string) (*models.CargoCrate, error)
- func (p *PostgresDB) GetCleanupPolicy(ctx context.Context, id string) (*models.CleanupPolicy, error)
- func (p *PostgresDB) GetComponentByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
- func (p *PostgresDB) GetComponentByID(ctx context.Context, id string) (*models.Component, error)
- func (p *PostgresDB) GetComponentBySHA256(ctx context.Context, repoID, sha256 string) (*models.Component, error)
- func (p *PostgresDB) GetComponentsByRepo(ctx context.Context, repoID string) ([]models.Component, error)
- func (p *PostgresDB) GetConanPackage(ctx context.Context, repoID string, key models.ConanFileKey) (*models.ConanPackage, error)
- func (p *PostgresDB) GetCondaPackageFile(ctx context.Context, ...) (*models.CondaPackage, error)
- func (p *PostgresDB) GetDB() *sql.DB
- func (p *PostgresDB) GetDebBlobInfo(ctx context.Context, blobID string) (string, int64, error)
- func (p *PostgresDB) GetDebPackageByID(ctx context.Context, id string) (*models.DebPackage, error)
- func (p *PostgresDB) GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
- func (p *PostgresDB) GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
- func (p *PostgresDB) GetDebianDistribution(ctx context.Context, repoID string, name string) (*models.DebianDistribution, error)
- func (p *PostgresDB) GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
- func (p *PostgresDB) GetDebianPackageByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
- func (p *PostgresDB) GetDebianPackagesByDistComp(ctx context.Context, repoID string, dist string, comp string, arch string) ([]models.Component, error)
- func (p *PostgresDB) GetDockerBlob(ctx context.Context, repoID, digest string) (*models.DockerBlob, error)
- func (p *PostgresDB) GetDockerManifest(ctx context.Context, repoID, image, digest string) (*models.DockerManifest, error)
- func (p *PostgresDB) GetDockerTag(ctx context.Context, repoID, image, name string) (*models.DockerTag, error)
- func (p *PostgresDB) GetDockerUpload(ctx context.Context, repositoryID, uploadUUID string) (*models.DockerUpload, error)
- func (p *PostgresDB) GetGoModule(ctx context.Context, repoID, modulePath, version string) (*models.GoModule, error)
- func (p *PostgresDB) GetGroupByID(ctx context.Context, id string) (*models.Group, error)
- func (p *PostgresDB) GetGroupByName(ctx context.Context, name string) (*models.Group, error)
- func (p *PostgresDB) GetHelmChart(ctx context.Context, repoID, name, version string) (*models.HelmChart, error)
- func (p *PostgresDB) GetIvyArtifact(ctx context.Context, ...) (*models.IvyArtifact, error)
- func (p *PostgresDB) GetLatestSnapshot(ctx context.Context, repoID, groupID, artifactID, version string) (*models.MavenArtifact, error)
- func (p *PostgresDB) GetLatestSnapshotFile(ctx context.Context, ...) (*models.MavenArtifact, error)
- func (p *PostgresDB) GetLicensePolicy(ctx context.Context, id string) (*models.LicensePolicy, error)
- func (p *PostgresDB) GetLicenseScanResult(ctx context.Context, repoID, artifactID string) (*models.LicenseScanResult, error)
- func (p *PostgresDB) GetLicenseScanResultByID(ctx context.Context, repoID, id string) (*models.LicenseScanResult, error)
- func (p *PostgresDB) GetMavenArtifactByPath(ctx context.Context, repoID, path string) (*models.MavenArtifact, error)
- func (p *PostgresDB) GetMavenArtifactsByGA(ctx context.Context, repoID, groupID, artifactID string) ([]*models.MavenArtifact, error)
- func (p *PostgresDB) GetMavenArtifactsByGAV(ctx context.Context, repoID, groupID, artifactID, version string) ([]*models.MavenArtifact, error)
- func (p *PostgresDB) GetNPMDistTags(ctx context.Context, packageID string) (map[string]string, error)
- func (p *PostgresDB) GetNPMPackageByName(ctx context.Context, repoID, fullName string) (*models.NPMPackage, error)
- func (p *PostgresDB) GetNPMVersion(ctx context.Context, packageID, version string) (*models.NPMVersion, error)
- func (p *PostgresDB) GetNPMVersionStates(ctx context.Context, packageID string) ([]models.NPMVersionState, error)
- func (p *PostgresDB) GetNPMVersionsByPackage(ctx context.Context, packageID string) ([]*models.NPMVersion, error)
- func (p *PostgresDB) GetNuGetPackage(ctx context.Context, repoID, packageID, version string) (*models.NuGetPackage, error)
- func (p *PostgresDB) GetOrCreateDebianArchitecture(ctx context.Context, distID, name string) (*models.DebianArchitecture, error)
- func (p *PostgresDB) GetOrCreateDebianComponent(ctx context.Context, distID, name string) (*models.DebianComponent, error)
- func (p *PostgresDB) GetOrCreateDebianDistribution(ctx context.Context, repoID, name string) (*models.DebianDistribution, error)
- func (p *PostgresDB) GetOrCreateGroup(ctx context.Context, name string) (*models.Group, error)
- func (p *PostgresDB) GetOrCreatePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
- func (p *PostgresDB) GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
- func (p *PostgresDB) GetPackageDelta(ctx context.Context, repoID, fromSHA256, toSHA256 string) (*models.PackageDelta, error)
- func (p *PostgresDB) GetPermissionTargetByID(ctx context.Context, id string) (*models.PermissionTarget, error)
- func (p *PostgresDB) GetPermissionTargetByName(ctx context.Context, name string) (*models.PermissionTarget, error)
- func (p *PostgresDB) GetPermissionTargetsForPrincipal(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
- func (p *PostgresDB) GetPermissionTargetsForPrincipalUncached(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
- func (p *PostgresDB) GetPresignedUpload(ctx context.Context, repoID, id string) (*models.PresignedUpload, error)
- func (p *PostgresDB) GetProject(ctx context.Context, id string) (*models.Project, error)
- func (p *PostgresDB) GetProjectByName(ctx context.Context, name string) (*models.Project, error)
- func (p *PostgresDB) GetProjectGroup(ctx context.Context, projectID, groupID string) (*models.ProjectGroup, error)
- func (p *PostgresDB) GetProjectMember(ctx context.Context, projectID, userID string) (*models.ProjectMember, error)
- func (p *PostgresDB) GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
- func (p *PostgresDB) GetProjectUsage(ctx context.Context, projectID string) (*models.ProjectUsage, error)
- func (p *PostgresDB) GetPromotionPipelineByID(ctx context.Context, id string) (*models.PromotionPipeline, error)
- func (p *PostgresDB) GetPromotionPipelineByName(ctx context.Context, name string) (*models.PromotionPipeline, error)
- func (p *PostgresDB) GetProxyCacheEntry(ctx context.Context, repoID, cacheKey string) (*models.ProxyCacheEntry, error)
- func (p *PostgresDB) GetPyPIPackage(ctx context.Context, repoID, name, version, filename string) (*models.PyPIPackage, error)
- func (p *PostgresDB) GetPyPIPackageByFilename(ctx context.Context, repoID, filename string) (*models.PyPIPackage, error)
- func (p *PostgresDB) GetRPMRepo(ctx context.Context, repositoryID string) (*models.RPMRepo, error)
- func (p *PostgresDB) GetRawArtifact(ctx context.Context, repoID, path string) (*models.RawArtifact, error)
- func (p *PostgresDB) GetReleaseBundle(ctx context.Context, name, version string) (*models.ReleaseBundle, error)
- func (p *PostgresDB) GetReleaseBundleByID(ctx context.Context, id string) (*models.ReleaseBundle, error)
- func (p *PostgresDB) GetRepoComponentBlob(ctx context.Context, repoID, id string) (*models.ComponentBlob, error)
- func (p *PostgresDB) GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
- func (p *PostgresDB) GetRepoMetadataByRepo(ctx context.Context, repositoryID string) ([]models.RepoMetadata, error)
- func (p *PostgresDB) GetRepositoryByID(ctx context.Context, id string) (*models.Repository, error)
- func (p *PostgresDB) GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
- func (p *PostgresDB) GetRepositoryByNameUncached(ctx context.Context, name string) (*models.Repository, error)
- func (p *PostgresDB) GetRpmPackageByID(ctx context.Context, id string) (*models.RpmPackage, error)
- func (p *PostgresDB) GetRubyGem(ctx context.Context, repoID, name, version, platform string) (*models.RubyGem, error)
- func (p *PostgresDB) GetSBOMReport(ctx context.Context, repoID, artifactID, format, specVersion string) (*models.SBOMReport, error)
- func (p *PostgresDB) GetSBOMReportByID(ctx context.Context, repoID, id string) (*models.SBOMReport, error)
- func (p *PostgresDB) GetSBTArtifact(ctx context.Context, repoID, groupID, artifactID, version, filename string) (*models.SBTArtifact, error)
- func (p *PostgresDB) GetSSOProviderByID(ctx context.Context, id string) (*models.SSOProvider, error)
- func (p *PostgresDB) GetSSOProviderBySlug(ctx context.Context, slug string) (*models.SSOProvider, error)
- func (p *PostgresDB) GetSecretScanResult(ctx context.Context, repoID, artifactID string) (*models.SecretScanResult, error)
- func (p *PostgresDB) GetSessionByTokenHash(ctx context.Context, hash string) (*models.Session, error)
- func (p *PostgresDB) GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
- func (p *PostgresDB) GetStoragePolicy(ctx context.Context, id string) (*models.StoragePolicy, error)
- func (p *PostgresDB) GetStorageTierByName(ctx context.Context, name string) (*models.StorageTier, error)
- func (p *PostgresDB) GetSystemSetting(ctx context.Context, key string) (string, error)
- func (p *PostgresDB) GetTokenByHash(ctx context.Context, hash string) (*models.Token, error)
- func (p *PostgresDB) GetTokenByHashUncached(ctx context.Context, hash string) (*models.Token, error)
- func (p *PostgresDB) GetTokenByID(ctx context.Context, tokenID string) (*models.Token, error)
- func (p *PostgresDB) GetTrashItem(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
- func (p *PostgresDB) GetUserByEmail(ctx context.Context, email string) (*models.User, error)
- func (p *PostgresDB) GetUserByExternalID(ctx context.Context, externalID, providerSlug string) (*models.User, error)
- func (p *PostgresDB) GetUserByID(ctx context.Context, id string) (*models.User, error)
- func (p *PostgresDB) GetUserByIDUncached(ctx context.Context, id string) (*models.User, error)
- func (p *PostgresDB) GetUserByUsername(ctx context.Context, username string) (*models.User, error)
- func (p *PostgresDB) GetVulnScanResult(ctx context.Context, repoID, artifactID string) (*models.VulnScanResult, error)
- func (p *PostgresDB) GetVulnScanResultByID(ctx context.Context, repoID, id string) (*models.VulnScanResult, error)
- func (p *PostgresDB) GetWebhook(ctx context.Context, id string) (*models.Webhook, error)
- func (p *PostgresDB) HelmIndexStamp(ctx context.Context, repoID string) (string, error)
- func (p *PostgresDB) IncrementCargoDownloadCount(ctx context.Context, repoID, name, version string) error
- func (p *PostgresDB) IncrementNuGetDownloadCount(ctx context.Context, repoID, packageID, version string) error
- func (p *PostgresDB) IncrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
- func (p *PostgresDB) InsertAuditLog(ctx context.Context, event *models.AuditLog) error
- func (p *PostgresDB) InsertRawArtifactIfAbsent(ctx context.Context, artifact *models.RawArtifact) (bool, error)
- func (p *PostgresDB) IsArtifactQuarantined(ctx context.Context, repoID string, keys []string) (bool, error)
- func (p *PostgresDB) LinkDockerBlob(ctx context.Context, repoID, image, digest string) error
- func (p *PostgresDB) ListAIAnalyses(ctx context.Context, repoID string, status string, licenseReviewOnly bool, ...) ([]*models.AIAnalysis, int, error)
- func (p *PostgresDB) ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
- func (p *PostgresDB) ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
- func (p *PostgresDB) ListAllProjects(ctx context.Context) ([]*models.Project, error)
- func (p *PostgresDB) ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
- func (p *PostgresDB) ListAllTokens(ctx context.Context, page, perPage int) ([]*models.Token, int, error)
- func (p *PostgresDB) ListArtifactProperties(ctx context.Context, repoID, artifactID string) (map[string]string, error)
- func (p *PostgresDB) ListAuditLogs(ctx context.Context, params models.AuditListParams) (*models.AuditPage, error)
- func (p *PostgresDB) ListBackupJobs(ctx context.Context, limit int) ([]*models.BackupJob, error)
- func (p *PostgresDB) ListBlobRefs(ctx context.Context, shas []string) (map[string][]models.BlobRef, error)
- func (p *PostgresDB) ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
- func (p *PostgresDB) ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
- func (p *PostgresDB) ListCargoCrateVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
- func (p *PostgresDB) ListCargoIndexVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
- func (p *PostgresDB) ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
- func (p *PostgresDB) ListComponentsByRepo(ctx context.Context, repoID, formatFilter string, page, limit int) ([]*models.Component, int, error)
- func (p *PostgresDB) ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
- func (p *PostgresDB) ListConanRecipeFiles(ctx context.Context, repoID, name, version, userChannel string) ([]*models.ConanPackage, error)
- func (p *PostgresDB) ListConanRecipes(ctx context.Context, repoID string) ([]models.ConanRecipe, error)
- func (p *PostgresDB) ListCondaPackages(ctx context.Context, repoID, platform string) ([]*models.CondaPackage, error)
- func (p *PostgresDB) ListDebPackageEntries(ctx context.Context, repoID, dist, comp, arch string) ([]models.DebPackageEntry, error)
- func (p *PostgresDB) ListDebPackagesByRepo(ctx context.Context, repoID string) ([]*models.DebPackage, error)
- func (p *PostgresDB) ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
- func (p *PostgresDB) ListDockerGCBlobs(ctx context.Context, repoID string, grace time.Duration, ...) ([]*models.DockerGCBlob, error)
- func (p *PostgresDB) ListDockerGCManifests(ctx context.Context, repoID string, grace time.Duration) ([]*models.DockerGCManifest, error)
- func (p *PostgresDB) ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
- func (p *PostgresDB) ListDockerManifestsBySubject(ctx context.Context, repoID, image, subjectDigest string) ([]*models.DockerManifest, error)
- func (p *PostgresDB) ListDockerTags(ctx context.Context, repoID, image, last string, n int) ([]*models.DockerTag, error)
- func (p *PostgresDB) ListDockerTagsByRepo(ctx context.Context, repoID string, limit int) ([]*models.DockerTag, error)
- func (p *PostgresDB) ListEnabledCleanupPolicies(ctx context.Context) ([]*models.CleanupPolicy, error)
- func (p *PostgresDB) ListEnabledSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
- func (p *PostgresDB) ListExpiredPresignedUploads(ctx context.Context, limit int) ([]string, error)
- func (p *PostgresDB) ListExpiredTrash(ctx context.Context, limit int) ([]models.TrashRef, error)
- func (p *PostgresDB) ListGlobalLicensePolicies(ctx context.Context) ([]*models.LicensePolicy, error)
- func (p *PostgresDB) ListGoModuleVersions(ctx context.Context, repoID, modulePath string) ([]*models.GoModule, error)
- func (p *PostgresDB) ListGoModulesByRepo(ctx context.Context, repoID string) ([]*models.GoModule, error)
- func (p *PostgresDB) ListGomodAffectedRows(ctx context.Context) ([]GomodAffectedRow, error)
- func (p *PostgresDB) ListGomodSiblingZipKeys(ctx context.Context) ([]string, error)
- func (p *PostgresDB) ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
- func (p *PostgresDB) ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
- func (p *PostgresDB) ListGroups(ctx context.Context) ([]*models.Group, error)
- func (p *PostgresDB) ListGroupsByUser(ctx context.Context, userID string) ([]*models.Group, error)
- func (p *PostgresDB) ListGroupsByUserUncached(ctx context.Context, userID string) ([]*models.Group, error)
- func (p *PostgresDB) ListHelmChartVersions(ctx context.Context, repoID, name string) ([]*models.HelmChart, error)
- func (p *PostgresDB) ListHelmCharts(ctx context.Context, repoID string) ([]*models.HelmChart, error)
- func (p *PostgresDB) ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
- func (p *PostgresDB) ListLicensePolicies(ctx context.Context, repoID string) ([]*models.LicensePolicy, error)
- func (p *PostgresDB) ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
- func (p *PostgresDB) ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
- func (p *PostgresDB) ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
- func (p *PostgresDB) ListNuGetPackageVersions(ctx context.Context, repoID, packageID string) ([]*models.NuGetPackage, error)
- func (p *PostgresDB) ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
- func (p *PostgresDB) ListPackageDeltas(ctx context.Context, repoID, toSHA256 string) ([]*models.PackageDelta, error)
- func (p *PostgresDB) ListPendingAIAnalyses(ctx context.Context, limit int) ([]*models.AIAnalysis, error)
- func (p *PostgresDB) ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
- func (p *PostgresDB) ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
- func (p *PostgresDB) ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
- func (p *PostgresDB) ListProjectCleanupRepositories(ctx context.Context, projectID string) ([]string, error)
- func (p *PostgresDB) ListProjectGrantsByUser(ctx context.Context, userID string) ([]*models.ProjectGrant, error)
- func (p *PostgresDB) ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
- func (p *PostgresDB) ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
- func (p *PostgresDB) ListProjectRepositories(ctx context.Context, projectID string, page, limit int) ([]*models.Repository, int, error)
- func (p *PostgresDB) ListProjectTokens(ctx context.Context, projectID string, createdBy *string) ([]*models.Token, error)
- func (p *PostgresDB) ListProjects(ctx context.Context, userID string) ([]*models.Project, error)
- func (p *PostgresDB) ListPromotionCandidates(ctx context.Context, backendIDs []string, after string, limit int) ([]models.BlobFacts, error)
- func (p *PostgresDB) ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
- func (p *PostgresDB) ListPublicRepositoryNames(ctx context.Context) ([]string, error)
- func (p *PostgresDB) ListPyPIPackageNames(ctx context.Context, repoID string) ([]string, error)
- func (p *PostgresDB) ListPyPIPackageVersions(ctx context.Context, repoID, name string) ([]*models.PyPIPackage, error)
- func (p *PostgresDB) ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
- func (p *PostgresDB) ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
- func (p *PostgresDB) ListRecoverableStorageTierMoves(ctx context.Context, maxAttempts int, retryAfter time.Duration, limit int) ([]*models.StorageTierMove, error)
- func (p *PostgresDB) ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
- func (p *PostgresDB) ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
- func (p *PostgresDB) ListRpmPackagesByRepo(ctx context.Context, repoID string) ([]*models.RpmPackage, error)
- func (p *PostgresDB) ListRpmPackagesForMetadata(ctx context.Context, repoID string) ([]pkgrpm.Package, error)
- func (p *PostgresDB) ListRubyGemSpecs(ctx context.Context, repoID string) ([]*models.RubyGem, error)
- func (p *PostgresDB) ListRubyGemVersions(ctx context.Context, repoID, name string) ([]*models.RubyGem, error)
- func (p *PostgresDB) ListRubyGems(ctx context.Context, repoID string) ([]*models.RubyGem, error)
- func (p *PostgresDB) ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
- func (p *PostgresDB) ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
- func (p *PostgresDB) ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
- func (p *PostgresDB) ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
- func (p *PostgresDB) ListStoragePolicies(ctx context.Context) ([]*models.StoragePolicy, error)
- func (p *PostgresDB) ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
- func (p *PostgresDB) ListStorageTierMoves(ctx context.Context, limit int) ([]*models.StorageTierMove, error)
- func (p *PostgresDB) ListStorageTiers(ctx context.Context) ([]*models.StorageTier, error)
- func (p *PostgresDB) ListTokensByUser(ctx context.Context, userID string) ([]*models.Token, error)
- func (p *PostgresDB) ListTrash(ctx context.Context, f models.TrashFilter) ([]*models.TrashItem, int, error)
- func (p *PostgresDB) ListUnindexedDockerManifests(ctx context.Context, repoID string, limit int) ([]*models.DockerGCManifest, error)
- func (p *PostgresDB) ListUnreferencedBlobs(ctx context.Context, minAge time.Duration, after string, scan, limit int) ([]string, string, error)
- func (p *PostgresDB) ListUserGroupMemberships(ctx context.Context) ([]*models.UserGroup, error)
- func (p *PostgresDB) ListUsers(ctx context.Context, page, perPage int) ([]*models.User, int, error)
- func (p *PostgresDB) ListUsersByGroup(ctx context.Context, groupID string) ([]*models.User, error)
- func (p *PostgresDB) ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
- func (p *PostgresDB) ListVulnScanOverview(ctx context.Context, params models.VulnScanListParams) (*models.VulnScanOverviewPage, error)
- func (p *PostgresDB) ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
- func (p *PostgresDB) ListWebhookDeliveries(ctx context.Context, webhookID string, limit int) ([]*models.WebhookDelivery, error)
- func (p *PostgresDB) ListWebhooks(ctx context.Context, repoID string) ([]*models.Webhook, error)
- func (p *PostgresDB) ListWebhooksForEvent(ctx context.Context, repoID, eventType string) ([]*models.Webhook, error)
- func (p *PostgresDB) MarkPackumentStale(ctx context.Context, packageID string) error
- func (p *PostgresDB) MarkPresignedUploadCompleted(ctx context.Context, id, artifactID string) error
- func (p *PostgresDB) MarkRepoStale(ctx context.Context, repositoryID string) error
- func (p *PostgresDB) Migrate(ctx context.Context) error
- func (p *PostgresDB) MoveRepositoryToProject(ctx context.Context, repoID, toProjectID string, maxRepositories int) error
- func (p *PostgresDB) Ping(ctx context.Context) error
- func (p *PostgresDB) PruneMavenMetadata(ctx context.Context, repositoryID, dir string, keep []string) ([]string, error)
- func (p *PostgresDB) PruneRepoDeltas(ctx context.Context, repoID string, maxCount int, maxBytes int64) ([]string, error)
- func (p *PostgresDB) PurgeExpiredBackupLeases(ctx context.Context) (int64, error)
- func (p *PostgresDB) PurgeTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashPurgeResult, error)
- func (p *PostgresDB) QuarantineArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
- func (p *PostgresDB) QuarantineVulnArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
- func (p *PostgresDB) ReconcileAllStorageUsage(ctx context.Context) (int64, error)
- func (p *PostgresDB) ReconcileStorageUsage(ctx context.Context, repoID string) (*models.StorageQuota, error)
- func (p *PostgresDB) RegenKeys(ctx context.Context, kind models.TrashKind, id string) (string, string, error)
- func (p *PostgresDB) ReleasePresignedUpload(ctx context.Context, id string) error
- func (p *PostgresDB) RelinkGomodZips(ctx context.Context, sha256 string, size int64, rowIDs []string) (int64, error)
- func (p *PostgresDB) RemoveBundleItem(ctx context.Context, bundleID, sha256 string) error
- func (p *PostgresDB) RemoveGroupMember(ctx context.Context, groupRepoID, memberRepoID string) error
- func (p *PostgresDB) RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
- func (p *PostgresDB) RepairBootstrapAdmin(ctx context.Context, username string) (bool, error)
- func (p *PostgresDB) ReplaceGroupMembers(ctx context.Context, groupRepoID string, memberIDs []string) error
- func (p *PostgresDB) ReserveStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) (bool, error)
- func (p *PostgresDB) RestoreTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
- func (p *PostgresDB) RevokeProjectToken(ctx context.Context, projectID, tokenID string) (bool, error)
- func (p *PostgresDB) RevokeToken(ctx context.Context, tokenID string) error
- func (p *PostgresDB) RpmPackageExists(ctx context.Context, repoID, name, version, release string, epoch int, ...) (bool, error)
- func (p *PostgresDB) RubyGemsSpecsStamp(ctx context.Context, repoID string) (string, error)
- func (p *PostgresDB) ScanTierCandidates(ctx context.Context, after string, window int, clauses []models.TierScanClause) ([]models.BlobFacts, string, int, error)
- func (p *PostgresDB) SealReleaseBundle(ctx context.Context, bundleID, sealedBy string, sealedAt time.Time) (bool, error)
- func (p *PostgresDB) SearchByProperty(ctx context.Context, repoID, key, value string) ([]string, error)
- func (p *PostgresDB) SearchCargoCrateSummaries(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrateSummary, int, error)
- func (p *PostgresDB) SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
- func (p *PostgresDB) SearchComponents(ctx context.Context, repoID string, opts ComponentListOptions) ([]*models.Component, int, error)
- func (p *PostgresDB) SearchNuGetPackages(ctx context.Context, repoID, query string, skip, take int) ([]*models.NuGetPackage, int, error)
- func (p *PostgresDB) SearchRubyGems(ctx context.Context, repoID, query string) ([]*models.RubyGem, error)
- func (p *PostgresDB) SetArtifactProperties(ctx context.Context, repoID, artifactID string, props map[string]string, ...) error
- func (p *PostgresDB) SetArtifactProperty(ctx context.Context, repoID, artifactID, key, value string) error
- func (p *PostgresDB) SetBlobDeletionGrace(d time.Duration)
- func (p *PostgresDB) SetDebControlFields(ctx context.Context, packageID, maintainer, homepage string, ...) error
- func (p *PostgresDB) SetDockerManifestRefs(ctx context.Context, repoID string, m *models.DockerGCManifest, ...) error
- func (p *PostgresDB) SetLicenseScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
- func (p *PostgresDB) SetNuGetDependencyGroups(ctx context.Context, repoID, packageID, version string, groups []byte) error
- func (p *PostgresDB) SetProjectGroup(ctx context.Context, projectID, groupID, role string, createdBy *string) error
- func (p *PostgresDB) SetProjectQuota(ctx context.Context, projectID string, maxSizeBytes, maxArtifactCount int64, ...) (*models.ProjectQuota, error)
- func (p *PostgresDB) SetSystemSetting(ctx context.Context, key, value string) error
- func (p *PostgresDB) SetTrashRetentionDays(days int)
- func (p *PostgresDB) SetVulnScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
- func (p *PostgresDB) StorageBackendBusyReason(ctx context.Context, backendID string) (string, error)
- func (p *PostgresDB) StorageTierUsage(ctx context.Context) ([]models.TierUsage, error)
- func (p *PostgresDB) SyncSSOGroups(ctx context.Context, userID string, groupIDs []string) error
- func (p *PostgresDB) SyncSSOPermissionsForGroup(ctx context.Context, groupID string, targetIDs []string) error
- func (p *PostgresDB) TouchBlobAccess(ctx context.Context, accessed map[string]time.Time, resolution time.Duration) (int64, error)
- func (p *PostgresDB) TouchDockerBlob(ctx context.Context, repoID, digest string) (bool, error)
- func (p *PostgresDB) TrashRepository(ctx context.Context, id, deletedBy string) (bool, error)
- func (p *PostgresDB) TrashRows(ctx context.Context, repoID string, kind models.TrashKind, ids []string, ...) (bool, error)
- func (p *PostgresDB) TrashedRepositoryByName(ctx context.Context, name string) (*models.TrashItem, error)
- func (p *PostgresDB) TryGomodRepairLock(ctx context.Context) (func(), bool, error)
- func (p *PostgresDB) UnreferencedBlobKeys(ctx context.Context, ids []string) ([]string, error)
- func (p *PostgresDB) UpdateBackupJob(ctx context.Context, job *models.BackupJob) error
- func (p *PostgresDB) UpdateBundlePromotion(ctx context.Context, pr *models.BundlePromotion) error
- func (p *PostgresDB) UpdateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
- func (p *PostgresDB) UpdateCleanupPolicyRunResult(ctx context.Context, id string, deletedCount int, runErr error) error
- func (p *PostgresDB) UpdateDockerUploadOffset(ctx context.Context, repositoryID, uploadUUID string, ...) (bool, error)
- func (p *PostgresDB) UpdateGroup(ctx context.Context, group *models.Group) error
- func (p *PostgresDB) UpdateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
- func (p *PostgresDB) UpdateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
- func (p *PostgresDB) UpdateNPMPackageLatestVersion(ctx context.Context, packageID, latestVersion string) error
- func (p *PostgresDB) UpdateNPMVersionManifest(ctx context.Context, packageID, version string, manifest []byte) error
- func (p *PostgresDB) UpdatePermissionTarget(ctx context.Context, target *models.PermissionTarget) error
- func (p *PostgresDB) UpdateProject(ctx context.Context, project *models.Project) error
- func (p *PostgresDB) UpdatePromotionPipeline(ctx context.Context, pp *models.PromotionPipeline) error
- func (p *PostgresDB) UpdateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
- func (p *PostgresDB) UpdateRepository(ctx context.Context, repo *models.Repository) error
- func (p *PostgresDB) UpdateRepositoryAndMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
- func (p *PostgresDB) UpdateRpmPackageExtra(ctx context.Context, repoID, sha256 string, extra []byte) error
- func (p *PostgresDB) UpdateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
- func (p *PostgresDB) UpdateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
- func (p *PostgresDB) UpdateSessionLastSeen(ctx context.Context, sessionID string, expiresAt time.Time) error
- func (p *PostgresDB) UpdateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
- func (p *PostgresDB) UpdateStorageBackendStatus(ctx context.Context, id, status string, message *string) error
- func (p *PostgresDB) UpdateStoragePolicy(ctx context.Context, pol *models.StoragePolicy) error
- func (p *PostgresDB) UpdateStorageQuota(ctx context.Context, quota *models.StorageQuota) error
- func (p *PostgresDB) UpdateStorageTier(ctx context.Context, t *models.StorageTier) error
- func (p *PostgresDB) UpdateTokenLastUsed(ctx context.Context, tokenID string) error
- func (p *PostgresDB) UpdateUser(ctx context.Context, user *models.User) error
- func (p *PostgresDB) UpdateUserLastLogin(ctx context.Context, id string, at time.Time) error
- func (p *PostgresDB) UpdateUserPassword(ctx context.Context, id, passwordHash string, mustChange bool) error
- func (p *PostgresDB) UpdateUserSSO(ctx context.Context, userID string, externalID, providerSlug string) error
- func (p *PostgresDB) UpdateUserSSOProfile(ctx context.Context, id string, email, fullName *string, lastLogin time.Time) error
- func (p *PostgresDB) UpdateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
- func (p *PostgresDB) UpdateWebhook(ctx context.Context, wh *models.Webhook) error
- func (p *PostgresDB) UpdateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
- func (p *PostgresDB) UpsertAIAnalysis(ctx context.Context, analysis *models.AIAnalysis) error
- func (p *PostgresDB) UpsertBlob(ctx context.Context, sha256, blobKey string, sizeBytes int64) (string, error)
- func (p *PostgresDB) UpsertDockerTag(ctx context.Context, tag *models.DockerTag) error
- func (p *PostgresDB) UpsertNPMDistTag(ctx context.Context, t *models.NPMDistTag) (*models.NPMDistTag, error)
- func (p *PostgresDB) UpsertProxyCacheEntry(ctx context.Context, entry *models.ProxyCacheEntry) error
- func (p *PostgresDB) UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
- func (p *PostgresDB) UpsertRepoMetadata(ctx context.Context, meta *models.RepoMetadata) error
- func (p *PostgresDB) UpsertVEXStatement(ctx context.Context, s *models.VEXStatement) error
- func (p *PostgresDB) VulnScanOverviewSummary(ctx context.Context, repoName string) (*models.VulnScanSummary, error)
- func (p *PostgresDB) WithBlobLock(ctx context.Context, sha256 string, fn func(ctx context.Context) error) error
- func (p *PostgresDB) WithBlobLocks(ctx context.Context, shas []string, fn func(ctx context.Context) error) error
- func (p *PostgresDB) YankCargoCrate(ctx context.Context, repoID, name, version string, yanked bool) error
- func (p *PostgresDB) YankRubyGem(ctx context.Context, repoID, name, version, platform string, yanked bool) error
- type PostgresTx
- func (t *PostgresTx) Commit() error
- func (t *PostgresTx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (t *PostgresTx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (t *PostgresTx) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (t *PostgresTx) Rollback() error
- type ProjectRoleGuard
- type ProjectTokenSpec
- type SnapshotReader
- type Transaction
- type TrashStore
Constants ¶
const ( // BlobDeletionScopeAll deletes every copy of the blob, on every tier: the // blob itself was deleted. BlobDeletionScopeAll = "*" // BlobDeletionScopePrimary deletes the copy on the primary (default) store. BlobDeletionScopePrimary = "" )
Scopes of a queued blob deletion (BlobDeletion.Scope). Any other value is the storage_backends id of the tier whose copy a placement flip retired.
Variables ¶
var ( ErrSBOMReportNotFound = errors.New("SBOM report not found") ErrLicensePolicyNotFound = errors.New("license policy not found") // ErrCreateComponentDeprecated is returned by CreateComponent, which was // split into CreateDebPackage and CreateRpmPackage. ErrCreateComponentDeprecated = errors.New("CreateComponent is deprecated: use CreateDebPackage or CreateRpmPackage, passing distribution_id and component_id for DEB") )
var ( // ErrVulnScanNotFound is returned when a vuln scan result does not exist in the repository. ErrVulnScanNotFound = errors.New("vuln scan result not found") // ErrBundleNotDraft is returned when a bundle mutation requires the draft state. ErrBundleNotDraft = errors.New("release bundle is not in draft state") // ErrBundleNotFound is returned when a release bundle does not exist. ErrBundleNotFound = errors.New("release bundle not found") )
var ( // ErrProjectTokenLimit: the project already has the maximum of active tokens. ErrProjectTokenLimit = errors.New("project token limit reached") // ErrProjectTokenName: an active token of the project already has the name. ErrProjectTokenName = errors.New("project token name already in use") )
Errors of project token creation.
var ( // ErrProjectNotFound: the project does not exist (any more). ErrProjectNotFound = errors.New("project not found") // ErrProjectOwnerLocked: the project's recorded owner can be neither // demoted nor removed. ErrProjectOwnerLocked = errors.New("the project owner cannot be demoted or removed") // ErrLastProjectOwner: the change would leave the project without an owner. ErrLastProjectOwner = errors.New("cannot remove or demote the last owner") )
Errors of the locked project member/group changes.
var ( // ErrTrashNotFound means no trashed row matches the kind/id (it was never // deleted, was already restored, or was purged). ErrTrashNotFound = errors.New("trash item not found") // ErrAmbiguousPyPIFilename means several packages of one repository hold a // file with the same name. ErrAmbiguousPyPIFilename = errors.New("pypi filename is ambiguous") // ErrTrashConflict means a restore collided with a live row that took over // the item's unique key while it sat in the trash. ErrTrashConflict = errors.New("a live item with the same identity already exists") // ErrTrashRepoTrashed means the item's repository is itself in the trash. ErrTrashRepoTrashed = errors.New("the item's repository is in the trash") // ErrTrashManifestInTrash means a docker tag cannot be restored because the // manifest it points at is itself in the trash (restore the manifest, which // brings its tags back). ErrTrashManifestInTrash = errors.New("the tag's manifest is in the trash") // ErrTrashUnknownKind means the kind is not a registered trash kind. ErrTrashUnknownKind = errors.New("unknown trash kind") )
var ErrChecksumDrift = errors.New("checksum drift")
var ErrDockerBlobsMissing = errors.New("manifest references a blob that is not available to the image")
ErrDockerBlobsMissing is returned by CreateDockerManifest when a blob the manifest requires is not (or no longer) available to its image.
var ErrDockerRowNotFound = errors.New("docker row not found")
ErrDockerRowNotFound is returned by DeleteDockerBlob and DeleteDockerManifest when no row matched: a concurrent request removed it first. Callers release the row's storage quota only when the delete removed it.
var ErrDuplicate = errors.New("artifact already exists")
ErrDuplicate is returned by Create*Package when an insert hits the unique constraint (ON CONFLICT), so callers can distinguish an idempotent duplicate upload (map to HTTP 409) from a real failure. This closes the check-then-insert TOCTOU: concurrent identical uploads race the existence check, but exactly one INSERT wins and the losers observe ErrDuplicate.
var ErrInvalidAuditLimit = errors.New("audit page limit must be positive")
ErrInvalidAuditLimit is returned by ListAuditLogs for a page size below 1.
var ErrInvalidBlobSHA256 = errors.New("invalid blob sha256: must be 64 lowercase hex characters")
ErrInvalidBlobSHA256 is returned when a blob row would be keyed by anything other than a lowercase 64-character hex SHA-256. blobs.sha256 is UNIQUE and every upsert resolves conflicts on it, so a single malformed value (the empty string in particular) would make unrelated artifacts share one row and serve each other's bytes.
var ErrInvalidConnOption = errors.New("invalid database option key")
ErrInvalidConnOption is returned when a database option key is not a valid PostgreSQL runtime parameter name.
var ErrInvalidVulnScanFilter = errors.New("invalid vulnerability scan filter")
ErrInvalidVulnScanFilter is returned by ListVulnScanOverview for a severity, status or scanner it does not know, and for a page size below 1.
var ErrLicenseScanNotFound = errors.New("license scan result not found")
ErrLicenseScanNotFound is returned when a license scan result does not exist in the repository.
var ErrMockNotImplemented = errors.New("BaseMockDB method not implemented")
ErrMockNotImplemented is returned by BaseMockDB methods a test has not overridden.
var ErrPresignedUploadCap = errors.New("too many pending presigned uploads")
ErrPresignedUploadCap is returned by CreatePresignedUploadCapped when the user already has the maximum number of outstanding uploads.
var ErrProjectQuotaExceeded = errors.New("project storage quota would be exceeded")
ErrProjectQuotaExceeded is returned when moving a repository would push the target project past its storage ceiling.
var ErrProjectRepoLimit = errors.New("project repository limit reached")
ErrProjectRepoLimit is returned when creating or moving a repository would exceed the project's max_repositories.
var ErrRepositoryNotFound = errors.New("repository not found")
ErrRepositoryNotFound is returned when a repository to modify does not exist (or is trashed).
var ErrVEXStatementNotFound = errors.New("VEX statement not found")
ErrVEXStatementNotFound is returned when a VEX statement does not exist in the repository.
Functions ¶
func IsForeignKeyViolation ¶ added in v0.2.0
IsForeignKeyViolation reports whether err is a PostgreSQL foreign_key_violation or restrict_violation: a referenced row cannot be removed or a referencing row points nowhere.
func IsUniqueViolation ¶ added in v0.2.0
IsUniqueViolation reports whether err is a PostgreSQL unique_violation.
func IsValidBlobSHA256 ¶ added in v0.5.0
IsValidBlobSHA256 reports whether s is a well-formed blobs.sha256 value. It mirrors storage.ValidateBlobID, which this package cannot import (storage depends on database).
func UniqueViolationConstraint ¶ added in v0.2.0
UniqueViolationConstraint returns the violated constraint/index name when err is a unique_violation, and "" otherwise.
Types ¶
type BaseMockDB ¶
type BaseMockDB struct{}
BaseMockDB provides stub implementations of every Database method.
func (*BaseMockDB) AddBundleItem ¶
func (m *BaseMockDB) AddBundleItem(ctx context.Context, item *models.ReleaseBundleItem) error
func (*BaseMockDB) AddBundleItems ¶ added in v0.2.0
func (m *BaseMockDB) AddBundleItems(ctx context.Context, bundleID string, items []*models.ReleaseBundleItem) error
func (*BaseMockDB) AddGroupMember ¶
func (*BaseMockDB) AddProjectMember ¶ added in v0.6.0
func (m *BaseMockDB) AddProjectMember(ctx context.Context, projectID, userID, role string) error
func (*BaseMockDB) AddUserToGroup ¶
func (m *BaseMockDB) AddUserToGroup(ctx context.Context, userID, groupID string) error
func (*BaseMockDB) ArtifactExists ¶
func (*BaseMockDB) ArtifactExistsBySHA256 ¶
func (*BaseMockDB) BeginBackupSnapshot ¶ added in v0.7.0
func (m *BaseMockDB) BeginBackupSnapshot(ctx context.Context, leaseTTL time.Duration) (SnapshotReader, error)
func (*BaseMockDB) BeginTx ¶
func (m *BaseMockDB) BeginTx(ctx context.Context) (Transaction, error)
func (*BaseMockDB) BlobReferenceCount ¶
func (*BaseMockDB) CargoIndexStamp ¶ added in v0.6.0
func (*BaseMockDB) ChangeProjectGroup ¶ added in v0.6.0
func (m *BaseMockDB) ChangeProjectGroup(ctx context.Context, projectID, groupID, newRole string, createdBy *string, guard ProjectRoleGuard) error
func (*BaseMockDB) ChangeProjectMember ¶ added in v0.6.0
func (m *BaseMockDB) ChangeProjectMember(ctx context.Context, projectID, userID, newRole string, guard ProjectRoleGuard) error
func (*BaseMockDB) ClaimPendingWebhookDeliveries ¶ added in v0.2.0
func (m *BaseMockDB) ClaimPendingWebhookDeliveries(ctx context.Context, limit int, lease time.Duration) ([]*models.WebhookDelivery, error)
func (*BaseMockDB) ClaimPresignedUpload ¶ added in v0.5.0
func (*BaseMockDB) Close ¶
func (m *BaseMockDB) Close() error
func (*BaseMockDB) CondaRepodataStamp ¶ added in v0.6.0
func (*BaseMockDB) ConsumeSAMLAssertion ¶ added in v0.2.0
func (*BaseMockDB) CountBlobsOnStorageBackend ¶ added in v0.2.0
func (*BaseMockDB) CountRepositories ¶
func (*BaseMockDB) CountRepositoriesByProject ¶ added in v0.6.0
func (*BaseMockDB) CountUsers ¶
func (m *BaseMockDB) CountUsers(ctx context.Context) (int, error)
func (*BaseMockDB) CreateBackupJob ¶
func (*BaseMockDB) CreateBootstrapAdmin ¶ added in v0.2.0
func (*BaseMockDB) CreateBundlePromotion ¶
func (m *BaseMockDB) CreateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
func (*BaseMockDB) CreateCargoCrate ¶
func (m *BaseMockDB) CreateCargoCrate(ctx context.Context, crate *models.CargoCrate) error
func (*BaseMockDB) CreateCleanupPolicy ¶
func (m *BaseMockDB) CreateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
func (*BaseMockDB) CreateComponent ¶
func (*BaseMockDB) CreateConanPackage ¶
func (m *BaseMockDB) CreateConanPackage(ctx context.Context, pkg *models.ConanPackage) error
func (*BaseMockDB) CreateCondaPackage ¶
func (m *BaseMockDB) CreateCondaPackage(ctx context.Context, pkg *models.CondaPackage) error
func (*BaseMockDB) CreateDebPackage ¶
func (*BaseMockDB) CreateDebianArchitecture ¶
func (m *BaseMockDB) CreateDebianArchitecture(ctx context.Context, arch *models.DebianArchitecture) error
func (*BaseMockDB) CreateDebianComponent ¶
func (m *BaseMockDB) CreateDebianComponent(ctx context.Context, comp *models.DebianComponent) error
func (*BaseMockDB) CreateDebianDistribution ¶
func (m *BaseMockDB) CreateDebianDistribution(ctx context.Context, dist *models.DebianDistribution) error
func (*BaseMockDB) CreateDockerBlob ¶
func (m *BaseMockDB) CreateDockerBlob(ctx context.Context, blob *models.DockerBlob) error
func (*BaseMockDB) CreateDockerManifest ¶
func (m *BaseMockDB) CreateDockerManifest(ctx context.Context, mf *models.DockerManifest) error
func (*BaseMockDB) CreateDockerUpload ¶
func (m *BaseMockDB) CreateDockerUpload(ctx context.Context, upload *models.DockerUpload) error
func (*BaseMockDB) CreateGoModule ¶
func (*BaseMockDB) CreateGroup ¶
func (*BaseMockDB) CreateHelmChart ¶
func (*BaseMockDB) CreateIvyArtifact ¶
func (m *BaseMockDB) CreateIvyArtifact(ctx context.Context, artifact *models.IvyArtifact) error
func (*BaseMockDB) CreateLicensePolicy ¶
func (m *BaseMockDB) CreateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
func (*BaseMockDB) CreateLicenseScanResult ¶
func (m *BaseMockDB) CreateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
func (*BaseMockDB) CreateMavenArtifact ¶
func (m *BaseMockDB) CreateMavenArtifact(ctx context.Context, a *models.MavenArtifact) error
func (*BaseMockDB) CreateNPMPackage ¶
func (m *BaseMockDB) CreateNPMPackage(ctx context.Context, p *models.NPMPackage) (*models.NPMPackage, error)
func (*BaseMockDB) CreateNPMVersion ¶
func (m *BaseMockDB) CreateNPMVersion(ctx context.Context, v *models.NPMVersion) (*models.NPMVersion, error)
func (*BaseMockDB) CreateNuGetPackage ¶
func (m *BaseMockDB) CreateNuGetPackage(ctx context.Context, pkg *models.NuGetPackage) error
func (*BaseMockDB) CreatePackageDelta ¶
func (m *BaseMockDB) CreatePackageDelta(ctx context.Context, delta *models.PackageDelta) error
func (*BaseMockDB) CreatePermissionAssignment ¶
func (m *BaseMockDB) CreatePermissionAssignment(ctx context.Context, assignment *models.PermissionAssignment) error
func (*BaseMockDB) CreatePermissionTarget ¶
func (m *BaseMockDB) CreatePermissionTarget(ctx context.Context, target *models.PermissionTarget) (*models.PermissionTarget, error)
func (*BaseMockDB) CreatePresignedUpload ¶ added in v0.5.0
func (m *BaseMockDB) CreatePresignedUpload(ctx context.Context, u *models.PresignedUpload) error
func (*BaseMockDB) CreatePresignedUploadCapped ¶ added in v0.5.0
func (m *BaseMockDB) CreatePresignedUploadCapped(ctx context.Context, u *models.PresignedUpload, maxPending int) error
func (*BaseMockDB) CreateProject ¶ added in v0.6.0
func (*BaseMockDB) CreateProjectRepository ¶ added in v0.6.0
func (m *BaseMockDB) CreateProjectRepository(ctx context.Context, repo *models.Repository, memberIDs []string, maxRepositories int) error
func (*BaseMockDB) CreateProjectToken ¶ added in v0.6.0
func (m *BaseMockDB) CreateProjectToken(ctx context.Context, spec ProjectTokenSpec) (*models.Token, error)
func (*BaseMockDB) CreatePromotionPipeline ¶
func (m *BaseMockDB) CreatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
func (*BaseMockDB) CreatePyPIPackage ¶
func (m *BaseMockDB) CreatePyPIPackage(ctx context.Context, pkg *models.PyPIPackage) error
func (*BaseMockDB) CreateRPMRepo ¶
func (*BaseMockDB) CreateReleaseBundle ¶
func (m *BaseMockDB) CreateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
func (*BaseMockDB) CreateRepository ¶
func (m *BaseMockDB) CreateRepository(ctx context.Context, repo *models.Repository) error
func (*BaseMockDB) CreateRepositoryWithMembers ¶ added in v0.2.0
func (m *BaseMockDB) CreateRepositoryWithMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
func (*BaseMockDB) CreateRpmPackage ¶
func (*BaseMockDB) CreateRubyGem ¶
func (*BaseMockDB) CreateSBOMReport ¶
func (m *BaseMockDB) CreateSBOMReport(ctx context.Context, report *models.SBOMReport) error
func (*BaseMockDB) CreateSBTArtifact ¶
func (m *BaseMockDB) CreateSBTArtifact(ctx context.Context, artifact *models.SBTArtifact) error
func (*BaseMockDB) CreateSSOProvider ¶
func (m *BaseMockDB) CreateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
func (*BaseMockDB) CreateSecretScanResult ¶
func (m *BaseMockDB) CreateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
func (*BaseMockDB) CreateSession ¶
func (*BaseMockDB) CreateStorageBackend ¶
func (m *BaseMockDB) CreateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
func (*BaseMockDB) CreateToken ¶
func (*BaseMockDB) CreateUser ¶
func (*BaseMockDB) CreateVulnScanResult ¶
func (m *BaseMockDB) CreateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
func (*BaseMockDB) CreateWebhook ¶
func (*BaseMockDB) CreateWebhookDelivery ¶
func (m *BaseMockDB) CreateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
func (*BaseMockDB) DecrementStorageUsage ¶
func (*BaseMockDB) DeleteAIAnalysis ¶
func (m *BaseMockDB) DeleteAIAnalysis(ctx context.Context, repoID, artifactID string) error
func (*BaseMockDB) DeleteArtifactProperty ¶
func (m *BaseMockDB) DeleteArtifactProperty(ctx context.Context, repoID, artifactID, key string) error
func (*BaseMockDB) DeleteCargoCrate ¶
func (m *BaseMockDB) DeleteCargoCrate(ctx context.Context, id string) error
func (*BaseMockDB) DeleteCleanupPolicy ¶
func (m *BaseMockDB) DeleteCleanupPolicy(ctx context.Context, id string) error
func (*BaseMockDB) DeleteComponent ¶
func (m *BaseMockDB) DeleteComponent(ctx context.Context, componentID string) error
func (*BaseMockDB) DeleteConanPackage ¶
func (m *BaseMockDB) DeleteConanPackage(ctx context.Context, id string) error
func (*BaseMockDB) DeleteCondaPackage ¶
func (m *BaseMockDB) DeleteCondaPackage(ctx context.Context, id string) error
func (*BaseMockDB) DeleteDockerBlob ¶
func (m *BaseMockDB) DeleteDockerBlob(ctx context.Context, repoID, digest string) error
func (*BaseMockDB) DeleteDockerManifest ¶
func (m *BaseMockDB) DeleteDockerManifest(ctx context.Context, repoID, image, digest string) error
func (*BaseMockDB) DeleteDockerTag ¶
func (m *BaseMockDB) DeleteDockerTag(ctx context.Context, repoID, image, name string) error
func (*BaseMockDB) DeleteDockerTagsByDigest ¶ added in v0.4.0
func (m *BaseMockDB) DeleteDockerTagsByDigest(ctx context.Context, repoID, image, digest string) error
func (*BaseMockDB) DeleteDockerUpload ¶
func (m *BaseMockDB) DeleteDockerUpload(ctx context.Context, repositoryID, uploadUUID string) error
func (*BaseMockDB) DeleteExpiredProxyCacheEntries ¶
func (m *BaseMockDB) DeleteExpiredProxyCacheEntries(ctx context.Context) (int64, error)
func (*BaseMockDB) DeleteGoModule ¶
func (m *BaseMockDB) DeleteGoModule(ctx context.Context, repoID, modulePath, version string) error
func (*BaseMockDB) DeleteGroup ¶
func (m *BaseMockDB) DeleteGroup(ctx context.Context, id string) error
func (*BaseMockDB) DeleteHelmChart ¶
func (m *BaseMockDB) DeleteHelmChart(ctx context.Context, repoID, name, version string) error
func (*BaseMockDB) DeleteIvyArtifact ¶
func (m *BaseMockDB) DeleteIvyArtifact(ctx context.Context, id string) error
func (*BaseMockDB) DeleteLicensePolicy ¶
func (m *BaseMockDB) DeleteLicensePolicy(ctx context.Context, id string) error
func (*BaseMockDB) DeleteMavenArtifact ¶
func (m *BaseMockDB) DeleteMavenArtifact(ctx context.Context, id string) error
func (*BaseMockDB) DeleteNPMDistTag ¶
func (m *BaseMockDB) DeleteNPMDistTag(ctx context.Context, packageID, tag string) error
func (*BaseMockDB) DeleteNPMPackage ¶
func (m *BaseMockDB) DeleteNPMPackage(ctx context.Context, packageID string) error
func (*BaseMockDB) DeleteNPMVersion ¶
func (m *BaseMockDB) DeleteNPMVersion(ctx context.Context, packageID, version string) error
func (*BaseMockDB) DeleteNuGetPackage ¶
func (m *BaseMockDB) DeleteNuGetPackage(ctx context.Context, repoID, packageID, version string) error
func (*BaseMockDB) DeleteOtherSessionsByUser ¶ added in v0.2.0
func (m *BaseMockDB) DeleteOtherSessionsByUser(ctx context.Context, userID, keepTokenHash string) error
func (*BaseMockDB) DeletePackageDelta ¶
func (m *BaseMockDB) DeletePackageDelta(ctx context.Context, id string) error
func (*BaseMockDB) DeletePermissionAssignment ¶
func (m *BaseMockDB) DeletePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
func (*BaseMockDB) DeletePermissionTarget ¶
func (m *BaseMockDB) DeletePermissionTarget(ctx context.Context, id string) error
func (*BaseMockDB) DeletePresignedUpload ¶ added in v0.5.0
func (m *BaseMockDB) DeletePresignedUpload(ctx context.Context, id string) error
func (*BaseMockDB) DeleteProject ¶ added in v0.6.0
func (m *BaseMockDB) DeleteProject(ctx context.Context, id string) error
func (*BaseMockDB) DeletePromotionPipeline ¶
func (m *BaseMockDB) DeletePromotionPipeline(ctx context.Context, id string) error
func (*BaseMockDB) DeleteProxyCacheEntry ¶
func (m *BaseMockDB) DeleteProxyCacheEntry(ctx context.Context, repoID, cacheKey string) error
func (*BaseMockDB) DeletePyPIPackage ¶
func (m *BaseMockDB) DeletePyPIPackage(ctx context.Context, repoID, name, version, filename string) error
func (*BaseMockDB) DeleteRawArtifact ¶
func (m *BaseMockDB) DeleteRawArtifact(ctx context.Context, repoID, path string) error
func (*BaseMockDB) DeleteReleaseBundle ¶
func (m *BaseMockDB) DeleteReleaseBundle(ctx context.Context, id string) error
func (*BaseMockDB) DeleteRepository ¶
func (m *BaseMockDB) DeleteRepository(ctx context.Context, id string) error
func (*BaseMockDB) DeleteRubyGem ¶
func (m *BaseMockDB) DeleteRubyGem(ctx context.Context, id string) error
func (*BaseMockDB) DeleteSBOMReport ¶
func (m *BaseMockDB) DeleteSBOMReport(ctx context.Context, id string) error
func (*BaseMockDB) DeleteSBOMReportInRepo ¶ added in v0.2.0
func (*BaseMockDB) DeleteSBTArtifact ¶
func (m *BaseMockDB) DeleteSBTArtifact(ctx context.Context, id string) error
func (*BaseMockDB) DeleteSSOProvider ¶
func (m *BaseMockDB) DeleteSSOProvider(ctx context.Context, id string) error
func (*BaseMockDB) DeleteSession ¶
func (m *BaseMockDB) DeleteSession(ctx context.Context, tokenHash string) error
func (*BaseMockDB) DeleteSessionsByUser ¶ added in v0.2.0
func (m *BaseMockDB) DeleteSessionsByUser(ctx context.Context, userID string) error
func (*BaseMockDB) DeleteStorageBackend ¶
func (m *BaseMockDB) DeleteStorageBackend(ctx context.Context, id string) error
func (*BaseMockDB) DeleteVEXStatement ¶ added in v0.7.0
func (m *BaseMockDB) DeleteVEXStatement(ctx context.Context, repoID, id string) error
func (*BaseMockDB) DeleteVulnScanResult ¶ added in v0.2.0
func (m *BaseMockDB) DeleteVulnScanResult(ctx context.Context, repoID, id string) error
func (*BaseMockDB) DeleteWebhook ¶
func (m *BaseMockDB) DeleteWebhook(ctx context.Context, id string) error
func (*BaseMockDB) EnsureBlob ¶
func (*BaseMockDB) ExistingPresignedUploadIDs ¶ added in v0.5.0
func (*BaseMockDB) GetAIAnalysis ¶
func (m *BaseMockDB) GetAIAnalysis(ctx context.Context, repoID, artifactID string) (*models.AIAnalysis, error)
func (*BaseMockDB) GetArtifactProperty ¶
func (*BaseMockDB) GetBackupJob ¶
func (*BaseMockDB) GetBundleItem ¶
func (m *BaseMockDB) GetBundleItem(ctx context.Context, bundleID, sha256 string) (*models.ReleaseBundleItem, error)
func (*BaseMockDB) GetCargoCrate ¶
func (m *BaseMockDB) GetCargoCrate(ctx context.Context, repoID, name, version string) (*models.CargoCrate, error)
func (*BaseMockDB) GetCleanupPolicy ¶
func (m *BaseMockDB) GetCleanupPolicy(ctx context.Context, id string) (*models.CleanupPolicy, error)
func (*BaseMockDB) GetComponentByFilename ¶
func (*BaseMockDB) GetComponentByID ¶
func (*BaseMockDB) GetComponentBySHA256 ¶ added in v0.5.0
func (*BaseMockDB) GetComponentsByRepo ¶
func (*BaseMockDB) GetConanPackage ¶
func (m *BaseMockDB) GetConanPackage(ctx context.Context, repoID string, key models.ConanFileKey) (*models.ConanPackage, error)
func (*BaseMockDB) GetCondaPackageFile ¶ added in v0.5.0
func (m *BaseMockDB) GetCondaPackageFile(ctx context.Context, repoID, name, version, buildString, platform, extension string) (*models.CondaPackage, error)
func (*BaseMockDB) GetDB ¶
func (m *BaseMockDB) GetDB() *sql.DB
func (*BaseMockDB) GetDebBlobInfo ¶ added in v0.2.0
func (*BaseMockDB) GetDebPackageByID ¶
func (m *BaseMockDB) GetDebPackageByID(ctx context.Context, id string) (*models.DebPackage, error)
func (*BaseMockDB) GetDebianArchitecturesByDist ¶
func (m *BaseMockDB) GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
func (*BaseMockDB) GetDebianComponentsByDist ¶
func (m *BaseMockDB) GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
func (*BaseMockDB) GetDebianDistribution ¶
func (m *BaseMockDB) GetDebianDistribution(ctx context.Context, repoID string, name string) (*models.DebianDistribution, error)
func (*BaseMockDB) GetDebianDistributionsByRepo ¶
func (m *BaseMockDB) GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
func (*BaseMockDB) GetDebianPackageByFilename ¶
func (*BaseMockDB) GetDebianPackagesByDistComp ¶
func (*BaseMockDB) GetDockerBlob ¶
func (m *BaseMockDB) GetDockerBlob(ctx context.Context, repoID, digest string) (*models.DockerBlob, error)
func (*BaseMockDB) GetDockerManifest ¶
func (m *BaseMockDB) GetDockerManifest(ctx context.Context, repoID, image, digest string) (*models.DockerManifest, error)
func (*BaseMockDB) GetDockerTag ¶
func (*BaseMockDB) GetDockerUpload ¶
func (m *BaseMockDB) GetDockerUpload(ctx context.Context, repositoryID, uploadUUID string) (*models.DockerUpload, error)
func (*BaseMockDB) GetGoModule ¶
func (*BaseMockDB) GetGroupByID ¶
func (*BaseMockDB) GetGroupByName ¶
func (*BaseMockDB) GetHelmChart ¶
func (*BaseMockDB) GetIvyArtifact ¶
func (m *BaseMockDB) GetIvyArtifact(ctx context.Context, repoID, organisation, module, revision, artifactName, artifactExt string) (*models.IvyArtifact, error)
func (*BaseMockDB) GetLatestSnapshot ¶
func (m *BaseMockDB) GetLatestSnapshot(ctx context.Context, repoID, groupID, artifactID, version string) (*models.MavenArtifact, error)
func (*BaseMockDB) GetLatestSnapshotFile ¶ added in v0.5.0
func (m *BaseMockDB) GetLatestSnapshotFile(ctx context.Context, repoID, groupID, artifactID, version, classifier, extension string) (*models.MavenArtifact, error)
func (*BaseMockDB) GetLicensePolicy ¶
func (m *BaseMockDB) GetLicensePolicy(ctx context.Context, id string) (*models.LicensePolicy, error)
func (*BaseMockDB) GetLicenseScanResult ¶
func (m *BaseMockDB) GetLicenseScanResult(ctx context.Context, repoID, artifactID string) (*models.LicenseScanResult, error)
func (*BaseMockDB) GetLicenseScanResultByID ¶ added in v0.2.0
func (m *BaseMockDB) GetLicenseScanResultByID(ctx context.Context, repoID, id string) (*models.LicenseScanResult, error)
func (*BaseMockDB) GetMavenArtifactByPath ¶
func (m *BaseMockDB) GetMavenArtifactByPath(ctx context.Context, repoID, path string) (*models.MavenArtifact, error)
func (*BaseMockDB) GetMavenArtifactsByGA ¶
func (m *BaseMockDB) GetMavenArtifactsByGA(ctx context.Context, repoID, groupID, artifactID string) ([]*models.MavenArtifact, error)
func (*BaseMockDB) GetMavenArtifactsByGAV ¶
func (m *BaseMockDB) GetMavenArtifactsByGAV(ctx context.Context, repoID, groupID, artifactID, version string) ([]*models.MavenArtifact, error)
func (*BaseMockDB) GetNPMDistTags ¶
func (*BaseMockDB) GetNPMPackageByName ¶
func (m *BaseMockDB) GetNPMPackageByName(ctx context.Context, repoID, fullName string) (*models.NPMPackage, error)
func (*BaseMockDB) GetNPMVersion ¶
func (m *BaseMockDB) GetNPMVersion(ctx context.Context, packageID, version string) (*models.NPMVersion, error)
func (*BaseMockDB) GetNPMVersionStates ¶ added in v0.6.0
func (m *BaseMockDB) GetNPMVersionStates(ctx context.Context, packageID string) ([]models.NPMVersionState, error)
func (*BaseMockDB) GetNPMVersionsByPackage ¶
func (m *BaseMockDB) GetNPMVersionsByPackage(ctx context.Context, packageID string) ([]*models.NPMVersion, error)
func (*BaseMockDB) GetNuGetPackage ¶
func (m *BaseMockDB) GetNuGetPackage(ctx context.Context, repoID, packageID, version string) (*models.NuGetPackage, error)
func (*BaseMockDB) GetOrCreateDebianArchitecture ¶ added in v0.2.0
func (m *BaseMockDB) GetOrCreateDebianArchitecture(ctx context.Context, distID, name string) (*models.DebianArchitecture, error)
func (*BaseMockDB) GetOrCreateDebianComponent ¶ added in v0.2.0
func (m *BaseMockDB) GetOrCreateDebianComponent(ctx context.Context, distID, name string) (*models.DebianComponent, error)
func (*BaseMockDB) GetOrCreateDebianDistribution ¶ added in v0.2.0
func (m *BaseMockDB) GetOrCreateDebianDistribution(ctx context.Context, repoID, name string) (*models.DebianDistribution, error)
func (*BaseMockDB) GetOrCreateGroup ¶
func (*BaseMockDB) GetOrCreatePermissionAssignment ¶
func (m *BaseMockDB) GetOrCreatePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
func (*BaseMockDB) GetOrCreateStorageQuota ¶
func (m *BaseMockDB) GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
func (*BaseMockDB) GetPackageDelta ¶
func (m *BaseMockDB) GetPackageDelta(ctx context.Context, repoID, fromSHA256, toSHA256 string) (*models.PackageDelta, error)
func (*BaseMockDB) GetPermissionTargetByID ¶
func (m *BaseMockDB) GetPermissionTargetByID(ctx context.Context, id string) (*models.PermissionTarget, error)
func (*BaseMockDB) GetPermissionTargetByName ¶
func (m *BaseMockDB) GetPermissionTargetByName(ctx context.Context, name string) (*models.PermissionTarget, error)
func (*BaseMockDB) GetPermissionTargetsForPrincipal ¶
func (m *BaseMockDB) GetPermissionTargetsForPrincipal(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
func (*BaseMockDB) GetPresignedUpload ¶ added in v0.5.0
func (m *BaseMockDB) GetPresignedUpload(ctx context.Context, repoID, id string) (*models.PresignedUpload, error)
func (*BaseMockDB) GetProject ¶ added in v0.6.0
func (*BaseMockDB) GetProjectByName ¶ added in v0.6.0
func (*BaseMockDB) GetProjectGroup ¶ added in v0.6.0
func (m *BaseMockDB) GetProjectGroup(ctx context.Context, projectID, groupID string) (*models.ProjectGroup, error)
func (*BaseMockDB) GetProjectMember ¶ added in v0.6.0
func (m *BaseMockDB) GetProjectMember(ctx context.Context, projectID, userID string) (*models.ProjectMember, error)
func (*BaseMockDB) GetProjectQuota ¶ added in v0.6.0
func (m *BaseMockDB) GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
func (*BaseMockDB) GetProjectUsage ¶ added in v0.6.0
func (m *BaseMockDB) GetProjectUsage(ctx context.Context, projectID string) (*models.ProjectUsage, error)
func (*BaseMockDB) GetPromotionPipelineByID ¶
func (m *BaseMockDB) GetPromotionPipelineByID(ctx context.Context, id string) (*models.PromotionPipeline, error)
func (*BaseMockDB) GetPromotionPipelineByName ¶
func (m *BaseMockDB) GetPromotionPipelineByName(ctx context.Context, name string) (*models.PromotionPipeline, error)
func (*BaseMockDB) GetProxyCacheEntry ¶
func (m *BaseMockDB) GetProxyCacheEntry(ctx context.Context, repoID, cacheKey string) (*models.ProxyCacheEntry, error)
func (*BaseMockDB) GetPyPIPackage ¶
func (m *BaseMockDB) GetPyPIPackage(ctx context.Context, repoID, name, version, filename string) (*models.PyPIPackage, error)
func (*BaseMockDB) GetPyPIPackageByFilename ¶ added in v0.5.0
func (m *BaseMockDB) GetPyPIPackageByFilename(ctx context.Context, repoID, filename string) (*models.PyPIPackage, error)
func (*BaseMockDB) GetRPMRepo ¶
func (*BaseMockDB) GetRawArtifact ¶
func (m *BaseMockDB) GetRawArtifact(ctx context.Context, repoID, path string) (*models.RawArtifact, error)
func (*BaseMockDB) GetReleaseBundle ¶
func (m *BaseMockDB) GetReleaseBundle(ctx context.Context, name, version string) (*models.ReleaseBundle, error)
func (*BaseMockDB) GetReleaseBundleByID ¶
func (m *BaseMockDB) GetReleaseBundleByID(ctx context.Context, id string) (*models.ReleaseBundle, error)
func (*BaseMockDB) GetRepoComponentBlob ¶ added in v0.3.0
func (m *BaseMockDB) GetRepoComponentBlob(ctx context.Context, repoID, id string) (*models.ComponentBlob, error)
func (*BaseMockDB) GetRepoMetadataByPath ¶
func (m *BaseMockDB) GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
func (*BaseMockDB) GetRepoMetadataByRepo ¶
func (m *BaseMockDB) GetRepoMetadataByRepo(ctx context.Context, repositoryID string) ([]models.RepoMetadata, error)
func (*BaseMockDB) GetRepositoryByID ¶
func (m *BaseMockDB) GetRepositoryByID(ctx context.Context, id string) (*models.Repository, error)
func (*BaseMockDB) GetRepositoryByName ¶
func (m *BaseMockDB) GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
func (*BaseMockDB) GetRpmPackageByID ¶
func (m *BaseMockDB) GetRpmPackageByID(ctx context.Context, id string) (*models.RpmPackage, error)
func (*BaseMockDB) GetRubyGem ¶
func (*BaseMockDB) GetSBOMReport ¶
func (m *BaseMockDB) GetSBOMReport(ctx context.Context, repoID, artifactID, format, specVersion string) (*models.SBOMReport, error)
func (*BaseMockDB) GetSBOMReportByID ¶ added in v0.2.0
func (m *BaseMockDB) GetSBOMReportByID(ctx context.Context, repoID, id string) (*models.SBOMReport, error)
func (*BaseMockDB) GetSBTArtifact ¶
func (m *BaseMockDB) GetSBTArtifact(ctx context.Context, repoID, groupID, artifactID, version, filename string) (*models.SBTArtifact, error)
func (*BaseMockDB) GetSSOProviderByID ¶
func (m *BaseMockDB) GetSSOProviderByID(ctx context.Context, id string) (*models.SSOProvider, error)
func (*BaseMockDB) GetSSOProviderBySlug ¶
func (m *BaseMockDB) GetSSOProviderBySlug(ctx context.Context, slug string) (*models.SSOProvider, error)
func (*BaseMockDB) GetSecretScanResult ¶
func (m *BaseMockDB) GetSecretScanResult(ctx context.Context, repoID, artifactID string) (*models.SecretScanResult, error)
func (*BaseMockDB) GetSessionByTokenHash ¶
func (*BaseMockDB) GetStorageBackend ¶
func (m *BaseMockDB) GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
func (*BaseMockDB) GetSystemSetting ¶
func (*BaseMockDB) GetTokenByHash ¶
func (*BaseMockDB) GetTokenByID ¶
func (*BaseMockDB) GetUserByEmail ¶
func (*BaseMockDB) GetUserByExternalID ¶
func (*BaseMockDB) GetUserByID ¶
func (*BaseMockDB) GetUserByUsername ¶
func (*BaseMockDB) GetVulnScanResult ¶
func (m *BaseMockDB) GetVulnScanResult(ctx context.Context, repoID, artifactID string) (*models.VulnScanResult, error)
func (*BaseMockDB) GetVulnScanResultByID ¶ added in v0.2.0
func (m *BaseMockDB) GetVulnScanResultByID(ctx context.Context, repoID, id string) (*models.VulnScanResult, error)
func (*BaseMockDB) GetWebhook ¶
func (*BaseMockDB) HelmIndexStamp ¶ added in v0.6.0
func (*BaseMockDB) IncrementCargoDownloadCount ¶
func (m *BaseMockDB) IncrementCargoDownloadCount(ctx context.Context, repoID, name, version string) error
func (*BaseMockDB) IncrementNuGetDownloadCount ¶
func (m *BaseMockDB) IncrementNuGetDownloadCount(ctx context.Context, repoID, packageID, version string) error
func (*BaseMockDB) IncrementStorageUsage ¶
func (*BaseMockDB) InsertAuditLog ¶
func (*BaseMockDB) ListAIAnalyses ¶
func (*BaseMockDB) ListAllCondaPackages ¶
func (m *BaseMockDB) ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
func (*BaseMockDB) ListAllNPMPackages ¶
func (m *BaseMockDB) ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
func (*BaseMockDB) ListAllProjects ¶ added in v0.6.0
func (*BaseMockDB) ListAllSSOProviders ¶
func (m *BaseMockDB) ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
func (*BaseMockDB) ListAllTokens ¶
func (*BaseMockDB) ListArtifactProperties ¶
func (*BaseMockDB) ListAuditLogs ¶
func (m *BaseMockDB) ListAuditLogs(ctx context.Context, params models.AuditListParams) (*models.AuditPage, error)
func (*BaseMockDB) ListBackupJobs ¶
func (*BaseMockDB) ListBundleItems ¶
func (m *BaseMockDB) ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
func (*BaseMockDB) ListBundlePromotions ¶
func (m *BaseMockDB) ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
func (*BaseMockDB) ListCargoCrateVersions ¶
func (m *BaseMockDB) ListCargoCrateVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
func (*BaseMockDB) ListCargoIndexVersions ¶ added in v0.6.0
func (m *BaseMockDB) ListCargoIndexVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
func (*BaseMockDB) ListCleanupPolicies ¶
func (m *BaseMockDB) ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
func (*BaseMockDB) ListComponentsByRepo ¶
func (*BaseMockDB) ListConanPackages ¶
func (m *BaseMockDB) ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
func (*BaseMockDB) ListConanRecipeFiles ¶ added in v0.5.0
func (m *BaseMockDB) ListConanRecipeFiles(ctx context.Context, repoID, name, version, userChannel string) ([]*models.ConanPackage, error)
func (*BaseMockDB) ListConanRecipes ¶ added in v0.5.0
func (m *BaseMockDB) ListConanRecipes(ctx context.Context, repoID string) ([]models.ConanRecipe, error)
func (*BaseMockDB) ListCondaPackages ¶
func (m *BaseMockDB) ListCondaPackages(ctx context.Context, repoID, platform string) ([]*models.CondaPackage, error)
func (*BaseMockDB) ListDebPackageEntries ¶ added in v0.2.0
func (m *BaseMockDB) ListDebPackageEntries(ctx context.Context, repoID, dist, comp, arch string) ([]models.DebPackageEntry, error)
func (*BaseMockDB) ListDebPackagesByRepo ¶
func (m *BaseMockDB) ListDebPackagesByRepo(ctx context.Context, repoID string) ([]*models.DebPackage, error)
func (*BaseMockDB) ListDockerBlobs ¶
func (m *BaseMockDB) ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
func (*BaseMockDB) ListDockerManifestsByRepo ¶
func (m *BaseMockDB) ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
func (*BaseMockDB) ListDockerManifestsBySubject ¶
func (m *BaseMockDB) ListDockerManifestsBySubject(ctx context.Context, repoID, image, subjectDigest string) ([]*models.DockerManifest, error)
func (*BaseMockDB) ListDockerTags ¶
func (*BaseMockDB) ListDockerTagsByRepo ¶ added in v0.4.0
func (*BaseMockDB) ListEnabledCleanupPolicies ¶
func (m *BaseMockDB) ListEnabledCleanupPolicies(ctx context.Context) ([]*models.CleanupPolicy, error)
func (*BaseMockDB) ListEnabledSSOProviders ¶
func (m *BaseMockDB) ListEnabledSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
func (*BaseMockDB) ListExpiredPresignedUploads ¶ added in v0.5.0
func (*BaseMockDB) ListGlobalLicensePolicies ¶ added in v0.2.0
func (m *BaseMockDB) ListGlobalLicensePolicies(ctx context.Context) ([]*models.LicensePolicy, error)
func (*BaseMockDB) ListGoModuleVersions ¶
func (*BaseMockDB) ListGoModulesByRepo ¶
func (*BaseMockDB) ListGroupMemberRepositories ¶ added in v0.6.0
func (m *BaseMockDB) ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
func (*BaseMockDB) ListGroupMembers ¶
func (m *BaseMockDB) ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
func (*BaseMockDB) ListGroups ¶
func (*BaseMockDB) ListGroupsByUser ¶
func (*BaseMockDB) ListHelmChartVersions ¶
func (*BaseMockDB) ListHelmCharts ¶
func (*BaseMockDB) ListIvyArtifacts ¶
func (m *BaseMockDB) ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
func (*BaseMockDB) ListLicensePolicies ¶
func (m *BaseMockDB) ListLicensePolicies(ctx context.Context, repoID string) ([]*models.LicensePolicy, error)
ListLicensePolicies reports no policies: every upload that declares a license reads them (licensepolicy.Enforce), so an unconfigured mock must not fail those uploads. Tests of policy behavior override it.
func (*BaseMockDB) ListLicenseScanResults ¶
func (m *BaseMockDB) ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
func (*BaseMockDB) ListMavenArtifactsByRepo ¶
func (m *BaseMockDB) ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
func (*BaseMockDB) ListNPMVersionsByRepo ¶
func (m *BaseMockDB) ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
func (*BaseMockDB) ListNuGetPackageVersions ¶
func (m *BaseMockDB) ListNuGetPackageVersions(ctx context.Context, repoID, packageID string) ([]*models.NuGetPackage, error)
func (*BaseMockDB) ListNuGetPackages ¶
func (m *BaseMockDB) ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
func (*BaseMockDB) ListPackageDeltas ¶
func (m *BaseMockDB) ListPackageDeltas(ctx context.Context, repoID, toSHA256 string) ([]*models.PackageDelta, error)
func (*BaseMockDB) ListPendingAIAnalyses ¶
func (m *BaseMockDB) ListPendingAIAnalyses(ctx context.Context, limit int) ([]*models.AIAnalysis, error)
func (*BaseMockDB) ListPermissionAssignments ¶ added in v0.6.0
func (m *BaseMockDB) ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
func (*BaseMockDB) ListPermissionTargets ¶
func (m *BaseMockDB) ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
func (*BaseMockDB) ListProjectCleanupPolicies ¶ added in v0.6.0
func (m *BaseMockDB) ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
func (*BaseMockDB) ListProjectCleanupRepositories ¶ added in v0.6.0
func (*BaseMockDB) ListProjectGrantsByUser ¶ added in v0.6.0
func (m *BaseMockDB) ListProjectGrantsByUser(ctx context.Context, userID string) ([]*models.ProjectGrant, error)
ListProjectGrantsByUser reports no grants: the evaluator consults it for every request a permission target did not already allow.
func (*BaseMockDB) ListProjectGroups ¶ added in v0.6.0
func (m *BaseMockDB) ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
func (*BaseMockDB) ListProjectMembers ¶ added in v0.6.0
func (m *BaseMockDB) ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
func (*BaseMockDB) ListProjectRepositories ¶ added in v0.6.0
func (m *BaseMockDB) ListProjectRepositories(ctx context.Context, projectID string, page, limit int) ([]*models.Repository, int, error)
func (*BaseMockDB) ListProjectTokens ¶ added in v0.6.0
func (*BaseMockDB) ListProjects ¶ added in v0.6.0
func (*BaseMockDB) ListPromotionPipelines ¶
func (m *BaseMockDB) ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
func (*BaseMockDB) ListPublicRepositoryNames ¶ added in v0.3.0
func (m *BaseMockDB) ListPublicRepositoryNames(ctx context.Context) ([]string, error)
func (*BaseMockDB) ListPyPIPackageNames ¶ added in v0.6.0
func (*BaseMockDB) ListPyPIPackageVersions ¶
func (m *BaseMockDB) ListPyPIPackageVersions(ctx context.Context, repoID, name string) ([]*models.PyPIPackage, error)
func (*BaseMockDB) ListPyPIPackages ¶
func (m *BaseMockDB) ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
func (*BaseMockDB) ListRawArtifacts ¶
func (m *BaseMockDB) ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
func (*BaseMockDB) ListReleaseBundles ¶
func (m *BaseMockDB) ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
func (*BaseMockDB) ListRepositories ¶
func (m *BaseMockDB) ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
func (*BaseMockDB) ListRpmPackagesByRepo ¶
func (m *BaseMockDB) ListRpmPackagesByRepo(ctx context.Context, repoID string) ([]*models.RpmPackage, error)
func (*BaseMockDB) ListRpmPackagesForMetadata ¶ added in v0.2.0
func (*BaseMockDB) ListRubyGemSpecs ¶ added in v0.6.0
func (*BaseMockDB) ListRubyGemVersions ¶
func (*BaseMockDB) ListRubyGems ¶
func (*BaseMockDB) ListSBOMReports ¶
func (m *BaseMockDB) ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
func (*BaseMockDB) ListSBTArtifacts ¶
func (m *BaseMockDB) ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
func (*BaseMockDB) ListSecretScanResults ¶
func (m *BaseMockDB) ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
func (*BaseMockDB) ListStorageBackends ¶
func (m *BaseMockDB) ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
func (*BaseMockDB) ListStorageQuotas ¶ added in v0.6.0
func (m *BaseMockDB) ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
func (*BaseMockDB) ListTokensByUser ¶
func (*BaseMockDB) ListUserGroupMemberships ¶ added in v0.6.0
func (*BaseMockDB) ListUsersByGroup ¶
func (*BaseMockDB) ListVEXStatements ¶ added in v0.7.0
func (m *BaseMockDB) ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
func (*BaseMockDB) ListVulnScanOverview ¶ added in v0.7.0
func (m *BaseMockDB) ListVulnScanOverview(ctx context.Context, params models.VulnScanListParams) (*models.VulnScanOverviewPage, error)
func (*BaseMockDB) ListVulnScanResults ¶
func (m *BaseMockDB) ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
func (*BaseMockDB) ListWebhookDeliveries ¶
func (m *BaseMockDB) ListWebhookDeliveries(ctx context.Context, webhookID string, limit int) ([]*models.WebhookDelivery, error)
func (*BaseMockDB) ListWebhooks ¶
func (*BaseMockDB) ListWebhooksForEvent ¶
func (*BaseMockDB) MarkPackumentStale ¶
func (m *BaseMockDB) MarkPackumentStale(ctx context.Context, packageID string) error
func (*BaseMockDB) MarkPresignedUploadCompleted ¶ added in v0.5.0
func (m *BaseMockDB) MarkPresignedUploadCompleted(ctx context.Context, id, artifactID string) error
func (*BaseMockDB) MarkRepoStale ¶
func (m *BaseMockDB) MarkRepoStale(ctx context.Context, repositoryID string) error
func (*BaseMockDB) MoveRepositoryToProject ¶ added in v0.6.0
func (*BaseMockDB) QuarantineArtifact ¶
func (*BaseMockDB) QuarantineVulnArtifact ¶
func (*BaseMockDB) ReconcileAllStorageUsage ¶ added in v0.4.0
func (m *BaseMockDB) ReconcileAllStorageUsage(ctx context.Context) (int64, error)
func (*BaseMockDB) ReconcileStorageUsage ¶ added in v0.4.0
func (m *BaseMockDB) ReconcileStorageUsage(ctx context.Context, repoID string) (*models.StorageQuota, error)
func (*BaseMockDB) ReleasePresignedUpload ¶ added in v0.5.0
func (m *BaseMockDB) ReleasePresignedUpload(ctx context.Context, id string) error
func (*BaseMockDB) RemoveBundleItem ¶
func (m *BaseMockDB) RemoveBundleItem(ctx context.Context, bundleID, sha256 string) error
func (*BaseMockDB) RemoveGroupMember ¶
func (m *BaseMockDB) RemoveGroupMember(ctx context.Context, groupRepoID, memberRepoID string) error
func (*BaseMockDB) RemoveUserFromGroup ¶
func (m *BaseMockDB) RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
func (*BaseMockDB) RepairBootstrapAdmin ¶ added in v0.2.0
func (*BaseMockDB) ReplaceGroupMembers ¶ added in v0.2.0
func (*BaseMockDB) ReserveStorageUsage ¶ added in v0.2.0
func (*BaseMockDB) RevokeProjectToken ¶ added in v0.6.0
func (*BaseMockDB) RevokeToken ¶
func (m *BaseMockDB) RevokeToken(ctx context.Context, tokenID string) error
func (*BaseMockDB) RpmPackageExists ¶ added in v0.2.0
func (*BaseMockDB) RubyGemsSpecsStamp ¶ added in v0.6.0
func (*BaseMockDB) SealReleaseBundle ¶ added in v0.2.0
func (*BaseMockDB) SearchByProperty ¶
func (*BaseMockDB) SearchCargoCrateSummaries ¶ added in v0.5.0
func (m *BaseMockDB) SearchCargoCrateSummaries(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrateSummary, int, error)
func (*BaseMockDB) SearchCargoCrates ¶
func (m *BaseMockDB) SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
func (*BaseMockDB) SearchNuGetPackages ¶
func (m *BaseMockDB) SearchNuGetPackages(ctx context.Context, repoID, query string, skip, take int) ([]*models.NuGetPackage, int, error)
func (*BaseMockDB) SearchRubyGems ¶
func (*BaseMockDB) SetArtifactProperties ¶ added in v0.2.0
func (*BaseMockDB) SetArtifactProperty ¶
func (m *BaseMockDB) SetArtifactProperty(ctx context.Context, repoID, artifactID, key, value string) error
func (*BaseMockDB) SetDebControlFields ¶ added in v0.2.0
func (*BaseMockDB) SetLicenseScanQuarantine ¶ added in v0.4.0
func (*BaseMockDB) SetNuGetDependencyGroups ¶ added in v0.6.0
func (*BaseMockDB) SetProjectGroup ¶ added in v0.6.0
func (*BaseMockDB) SetProjectQuota ¶ added in v0.6.0
func (m *BaseMockDB) SetProjectQuota(ctx context.Context, projectID string, maxSizeBytes, maxArtifactCount int64, warnThresholdPercent int) (*models.ProjectQuota, error)
func (*BaseMockDB) SetSystemSetting ¶
func (m *BaseMockDB) SetSystemSetting(ctx context.Context, key, value string) error
func (*BaseMockDB) SetVulnScanQuarantine ¶ added in v0.2.0
func (*BaseMockDB) StorageBackendBusyReason ¶ added in v0.7.0
func (*BaseMockDB) SyncSSOGroups ¶
func (*BaseMockDB) SyncSSOPermissionsForGroup ¶
func (*BaseMockDB) UpdateBackupJob ¶
func (*BaseMockDB) UpdateBundlePromotion ¶
func (m *BaseMockDB) UpdateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
func (*BaseMockDB) UpdateCleanupPolicy ¶
func (m *BaseMockDB) UpdateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
func (*BaseMockDB) UpdateCleanupPolicyRunResult ¶
func (*BaseMockDB) UpdateDockerUploadOffset ¶
func (*BaseMockDB) UpdateGroup ¶
func (*BaseMockDB) UpdateLicensePolicy ¶
func (m *BaseMockDB) UpdateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
func (*BaseMockDB) UpdateLicenseScanResult ¶
func (m *BaseMockDB) UpdateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
func (*BaseMockDB) UpdateNPMPackageLatestVersion ¶
func (m *BaseMockDB) UpdateNPMPackageLatestVersion(ctx context.Context, packageID, latestVersion string) error
func (*BaseMockDB) UpdateNPMVersionManifest ¶ added in v0.5.0
func (*BaseMockDB) UpdatePermissionTarget ¶
func (m *BaseMockDB) UpdatePermissionTarget(ctx context.Context, target *models.PermissionTarget) error
func (*BaseMockDB) UpdateProject ¶ added in v0.6.0
func (*BaseMockDB) UpdatePromotionPipeline ¶
func (m *BaseMockDB) UpdatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
func (*BaseMockDB) UpdateReleaseBundle ¶
func (m *BaseMockDB) UpdateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
func (*BaseMockDB) UpdateRepository ¶
func (m *BaseMockDB) UpdateRepository(ctx context.Context, repo *models.Repository) error
func (*BaseMockDB) UpdateRepositoryAndMembers ¶ added in v0.5.0
func (m *BaseMockDB) UpdateRepositoryAndMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
func (*BaseMockDB) UpdateRpmPackageExtra ¶ added in v0.4.0
func (*BaseMockDB) UpdateSSOProvider ¶
func (m *BaseMockDB) UpdateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
func (*BaseMockDB) UpdateSecretScanResult ¶
func (m *BaseMockDB) UpdateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
func (*BaseMockDB) UpdateSessionLastSeen ¶
func (*BaseMockDB) UpdateStorageBackend ¶
func (m *BaseMockDB) UpdateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
func (*BaseMockDB) UpdateStorageBackendStatus ¶
func (*BaseMockDB) UpdateStorageQuota ¶
func (m *BaseMockDB) UpdateStorageQuota(ctx context.Context, quota *models.StorageQuota) error
func (*BaseMockDB) UpdateTokenLastUsed ¶
func (m *BaseMockDB) UpdateTokenLastUsed(ctx context.Context, tokenID string) error
func (*BaseMockDB) UpdateUser ¶
func (*BaseMockDB) UpdateUserLastLogin ¶ added in v0.5.0
func (*BaseMockDB) UpdateUserPassword ¶ added in v0.5.0
func (*BaseMockDB) UpdateUserSSO ¶
func (*BaseMockDB) UpdateUserSSOProfile ¶ added in v0.6.0
func (*BaseMockDB) UpdateVulnScanResult ¶
func (m *BaseMockDB) UpdateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
func (*BaseMockDB) UpdateWebhook ¶
func (*BaseMockDB) UpdateWebhookDelivery ¶
func (m *BaseMockDB) UpdateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
func (*BaseMockDB) UpsertAIAnalysis ¶
func (m *BaseMockDB) UpsertAIAnalysis(ctx context.Context, analysis *models.AIAnalysis) error
func (*BaseMockDB) UpsertBlob ¶
func (*BaseMockDB) UpsertDockerTag ¶
func (*BaseMockDB) UpsertNPMDistTag ¶
func (m *BaseMockDB) UpsertNPMDistTag(ctx context.Context, t *models.NPMDistTag) (*models.NPMDistTag, error)
func (*BaseMockDB) UpsertProxyCacheEntry ¶
func (m *BaseMockDB) UpsertProxyCacheEntry(ctx context.Context, entry *models.ProxyCacheEntry) error
func (*BaseMockDB) UpsertRawArtifact ¶
func (m *BaseMockDB) UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
func (*BaseMockDB) UpsertRepoMetadata ¶
func (m *BaseMockDB) UpsertRepoMetadata(ctx context.Context, meta *models.RepoMetadata) error
func (*BaseMockDB) UpsertVEXStatement ¶ added in v0.7.0
func (m *BaseMockDB) UpsertVEXStatement(ctx context.Context, s *models.VEXStatement) error
func (*BaseMockDB) VulnScanOverviewSummary ¶ added in v0.7.0
func (m *BaseMockDB) VulnScanOverviewSummary(ctx context.Context, repoName string) (*models.VulnScanSummary, error)
func (*BaseMockDB) YankCargoCrate ¶
func (*BaseMockDB) YankRubyGem ¶
type BlobDeletion ¶ added in v0.7.0
type BlobDeletion struct {
SHA256 string
Scope string
QueuedAt time.Time
NotBefore time.Time
Attempts int
}
BlobDeletion is a queued deletion of blob bytes (see EnqueueBlobDeletion).
type BlobDeletionStore ¶ added in v0.7.0
type BlobDeletionStore interface {
// ClaimBlobDeletions hands out up to limit deletions that are due: past
// their grace period and not needed by any running backup. A claimed row is
// invisible to other callers for claimFor.
ClaimBlobDeletions(ctx context.Context, limit int, claimFor time.Duration) ([]BlobDeletion, error)
// BlobDeletionDue re-checks, under the per-blob lock, that the deletion is
// still due.
BlobDeletionDue(ctx context.Context, sha256, scope string) (bool, error)
// DeleteBlobDeletion removes a queued deletion.
DeleteBlobDeletion(ctx context.Context, sha256, scope string) error
// CountBlobDeletions returns the queue length.
CountBlobDeletions(ctx context.Context) (int64, error)
// PurgeExpiredBackupLeases removes leases of backups that stopped renewing.
PurgeExpiredBackupLeases(ctx context.Context) (int64, error)
}
BlobDeletionStore is the deferred-deletion queue the blob deletion sweeper works through; *PostgresDB implements it. See docs/operations/storage.md.
type ComponentListOptions ¶ added in v0.6.0
type ComponentListOptions struct {
// Format restricts the listing to one package format ("" = all).
Format string
// Name restricts it to rows whose listed name equals Name exactly.
Name string
// Query keeps rows whose listed name or version contains Query, ignoring case.
Query string
// SortByName orders by (name, version) instead of newest first.
SortByName bool
Page int
Limit int
}
ComponentListOptions selects and orders a repository's package listing.
type ComponentSearcher ¶ added in v0.6.0
type ComponentSearcher interface {
SearchComponents(ctx context.Context, repoID string, opts ComponentListOptions) ([]*models.Component, int, error)
}
ComponentSearcher is implemented by stores that can filter and order a repository's package listing (GET /api/v1/repositories/{name}/packages with package_name, q or sort). Kept separate from the main interface so only the real store has to provide it. It returns the requested page and the total number of matching rows.
type Database ¶
type Database interface {
// GetDB returns the underlying sql.DB connection
GetDB() *sql.DB
// Close closes the database connection
Close() error
// Ping checks if the database is accessible
Ping(ctx context.Context) error
// BeginTx starts a new transaction
BeginTx(ctx context.Context) (Transaction, error)
// Migrate runs database migrations
Migrate(ctx context.Context) error
GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
GetRepositoryByID(ctx context.Context, id string) (*models.Repository, error)
CreateRepository(ctx context.Context, repo *models.Repository) error
// ListPublicRepositoryNames returns the names of all repositories flagged public.
ListPublicRepositoryNames(ctx context.Context) ([]string, error)
ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
CountRepositories(ctx context.Context, formatFilter string) (int, error)
UpdateRepository(ctx context.Context, repo *models.Repository) error
// UpdateRepositoryAndMembers is UpdateRepository plus ReplaceGroupMembers in
// one transaction.
UpdateRepositoryAndMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
DeleteRepository(ctx context.Context, id string) error
ListComponentsByRepo(ctx context.Context, repoID, formatFilter string, page, limit int) ([]*models.Component, int, error)
GetRPMRepo(ctx context.Context, repositoryID string) (*models.RPMRepo, error)
CreateRPMRepo(ctx context.Context, repo *models.RPMRepo) error
MarkRepoStale(ctx context.Context, repositoryID string) error
CreateComponent(ctx context.Context, component *models.Component) error
CreateDebPackage(ctx context.Context, pkg *models.Component, distID, compID string) error
CreateRpmPackage(ctx context.Context, pkg *models.Component) error
UpsertBlob(ctx context.Context, sha256, blobKey string, sizeBytes int64) (string, error)
GetComponentByID(ctx context.Context, id string) (*models.Component, error)
// GetRepoComponentBlob resolves a package-listing row id (any format) to its
// blob, scoped to repoID. Returns nil, nil when the id is not in that repository.
GetRepoComponentBlob(ctx context.Context, repoID, id string) (*models.ComponentBlob, error)
GetComponentByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
GetComponentsByRepo(ctx context.Context, repoID string) ([]models.Component, error)
// GetComponentBySHA256 returns the live rpm or deb package in a repository whose blob has the given sha256, or nil.
GetComponentBySHA256(ctx context.Context, repoID, sha256 string) (*models.Component, error)
DeleteComponent(ctx context.Context, componentID string) error
GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
GetRepoMetadataByRepo(ctx context.Context, repositoryID string) ([]models.RepoMetadata, error)
UpsertRepoMetadata(ctx context.Context, meta *models.RepoMetadata) error
CreateDebianDistribution(ctx context.Context, dist *models.DebianDistribution) error
GetDebianDistribution(ctx context.Context, repoID string, name string) (*models.DebianDistribution, error)
GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
CreateDebianComponent(ctx context.Context, comp *models.DebianComponent) error
GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
CreateDebianArchitecture(ctx context.Context, arch *models.DebianArchitecture) error
GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
GetDebianPackageByFilename(ctx context.Context, repoID string, filename string) (*models.Component, error)
GetDebianPackagesByDistComp(ctx context.Context, repoID string, dist string, comp string, arch string) ([]models.Component, error)
GetDebPackageByID(ctx context.Context, id string) (*models.DebPackage, error)
ListDebPackagesByRepo(ctx context.Context, repoID string) ([]*models.DebPackage, error)
GetOrCreateDebianDistribution(ctx context.Context, repoID, name string) (*models.DebianDistribution, error)
GetOrCreateDebianComponent(ctx context.Context, distID, name string) (*models.DebianComponent, error)
GetOrCreateDebianArchitecture(ctx context.Context, distID, name string) (*models.DebianArchitecture, error)
SetDebControlFields(ctx context.Context, packageID, maintainer, homepage string, fields map[string]string) error
GetDebBlobInfo(ctx context.Context, blobID string) (string, int64, error)
ListDebPackageEntries(ctx context.Context, repoID, dist, comp, arch string) ([]models.DebPackageEntry, error)
GetRpmPackageByID(ctx context.Context, id string) (*models.RpmPackage, error)
ListRpmPackagesByRepo(ctx context.Context, repoID string) ([]*models.RpmPackage, error)
// RpmPackageExists reports whether the repo already has a package with the given NEVRA.
RpmPackageExists(ctx context.Context, repoID, name, version, release string, epoch int, arch string) (bool, error)
// ListRpmPackagesForMetadata returns every rpm package of a repo with
// dependencies, files, changelogs and header range loaded.
ListRpmPackagesForMetadata(ctx context.Context, repoID string) ([]pkgrpm.Package, error)
// UpdateRpmPackageExtra replaces rpm_extra for the repo's package(s) whose
// blob has the given sha256 (used to backfill weak dependencies).
UpdateRpmPackageExtra(ctx context.Context, repoID, sha256 string, extra []byte) error
CreateMavenArtifact(ctx context.Context, a *models.MavenArtifact) error
GetMavenArtifactByPath(ctx context.Context, repoID, path string) (*models.MavenArtifact, error)
GetMavenArtifactsByGAV(ctx context.Context, repoID, groupID, artifactID, version string) ([]*models.MavenArtifact, error)
GetMavenArtifactsByGA(ctx context.Context, repoID, groupID, artifactID string) ([]*models.MavenArtifact, error)
GetLatestSnapshot(ctx context.Context, repoID, groupID, artifactID, version string) (*models.MavenArtifact, error)
// GetLatestSnapshotFile returns the newest snapshot build of the file with
// the given classifier and extension.
GetLatestSnapshotFile(ctx context.Context, repoID, groupID, artifactID, version, classifier, extension string) (*models.MavenArtifact, error)
DeleteMavenArtifact(ctx context.Context, id string) error
// ListMavenArtifactsByRepo is a bulk-list-by-repo method used only by
// backup export (no GA/path filter required).
ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
CreateNPMPackage(ctx context.Context, p *models.NPMPackage) (*models.NPMPackage, error)
GetNPMPackageByName(ctx context.Context, repoID, fullName string) (*models.NPMPackage, error)
DeleteNPMPackage(ctx context.Context, packageID string) error
MarkPackumentStale(ctx context.Context, packageID string) error
UpdateNPMPackageLatestVersion(ctx context.Context, packageID, latestVersion string) error
CreateNPMVersion(ctx context.Context, v *models.NPMVersion) (*models.NPMVersion, error)
GetNPMVersion(ctx context.Context, packageID, version string) (*models.NPMVersion, error)
GetNPMVersionsByPackage(ctx context.Context, packageID string) ([]*models.NPMVersion, error)
// GetNPMVersionStates returns number and deprecation of every live version
// of the package, without the manifests.
GetNPMVersionStates(ctx context.Context, packageID string) ([]models.NPMVersionState, error)
// UpdateNPMVersionManifest replaces the stored manifest of a live version
// (used for `npm deprecate`).
UpdateNPMVersionManifest(ctx context.Context, packageID, version string, manifest []byte) error
DeleteNPMVersion(ctx context.Context, packageID, version string) error
UpsertNPMDistTag(ctx context.Context, t *models.NPMDistTag) (*models.NPMDistTag, error)
GetNPMDistTags(ctx context.Context, packageID string) (map[string]string, error)
DeleteNPMDistTag(ctx context.Context, packageID, tag string) error
// ListAllNPMPackages/ListNPMVersionsByRepo are bulk-list-by-repo methods
// used only by backup export (no name/GA/platform filter required).
ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
// Docker Registry methods
CreateDockerBlob(ctx context.Context, blob *models.DockerBlob) error
GetDockerBlob(ctx context.Context, repoID, digest string) (*models.DockerBlob, error)
DeleteDockerBlob(ctx context.Context, repoID, digest string) error
ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
CreateDockerUpload(ctx context.Context, upload *models.DockerUpload) error
GetDockerUpload(ctx context.Context, repositoryID, uploadUUID string) (*models.DockerUpload, error)
// UpdateDockerUploadOffset is a compare-and-set: it moves the offset from
// oldOffset to newOffset and reports false when it no longer equals oldOffset.
UpdateDockerUploadOffset(ctx context.Context, repositoryID, uploadUUID string, oldOffset, newOffset int64) (bool, error)
DeleteDockerUpload(ctx context.Context, repositoryID, uploadUUID string) error
CreateDockerManifest(ctx context.Context, m *models.DockerManifest) error
GetDockerManifest(ctx context.Context, repoID, image, digest string) (*models.DockerManifest, error)
DeleteDockerManifest(ctx context.Context, repoID, image, digest string) error
// ListDockerManifestsByRepo is a bulk-list-by-repo method used only by
// backup export (no digest/subject filter required).
ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
UpsertDockerTag(ctx context.Context, tag *models.DockerTag) error
GetDockerTag(ctx context.Context, repoID, image, name string) (*models.DockerTag, error)
DeleteDockerTag(ctx context.Context, repoID, image, name string) error
// DeleteDockerTagsByDigest removes every tag of the image that points at digest.
DeleteDockerTagsByDigest(ctx context.Context, repoID, image, digest string) error
ListDockerTags(ctx context.Context, repoID, image, last string, n int) ([]*models.DockerTag, error)
// ListDockerTagsByRepo lists up to limit tags across every image of the repository (backup export).
ListDockerTagsByRepo(ctx context.Context, repoID string, limit int) ([]*models.DockerTag, error)
// EnsureBlob ensures the global blobs table has a row for sha256
// (creating it, or updating its media type, if needed) and returns its
// blobs.id. Used by manifest handlers that need a blob_id FK without an
// accompanying per-format registry row (unlike UpsertBlob's callers).
EnsureBlob(ctx context.Context, sha256, mediaType string, size int64) (string, error)
// ListDockerManifestsBySubject returns manifests in repoID whose OCI
// `subject` field points at subjectDigest, for the Referrers API.
ListDockerManifestsBySubject(ctx context.Context, repoID, image, subjectDigest string) ([]*models.DockerManifest, error)
// Proxy/Group repository methods
AddGroupMember(ctx context.Context, groupRepoID, memberRepoID string, priority int) error
RemoveGroupMember(ctx context.Context, groupRepoID, memberRepoID string) error
ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
// ListGroupMemberRepositories returns the live member repositories of a
// group in priority order (the order of ListGroupMembers) in one query.
ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
// ReplaceGroupMembers atomically replaces a group's ordered member list (empty clears it).
ReplaceGroupMembers(ctx context.Context, groupRepoID string, memberIDs []string) error
// CreateRepositoryWithMembers creates a repository and its group members in one transaction.
CreateRepositoryWithMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
// CreateProjectRepository is CreateRepositoryWithMembers under the project's
// max_repositories cap (ErrProjectRepoLimit), checked with the project row locked.
CreateProjectRepository(ctx context.Context, repo *models.Repository, memberIDs []string, maxRepositories int) error
// MoveRepositoryToProject reassigns a live repository to another project
// under the target's cap when maxRepositories > 0 (ErrProjectRepoLimit).
MoveRepositoryToProject(ctx context.Context, repoID, toProjectID string, maxRepositories int) error
GetProxyCacheEntry(ctx context.Context, repoID, cacheKey string) (*models.ProxyCacheEntry, error)
UpsertProxyCacheEntry(ctx context.Context, entry *models.ProxyCacheEntry) error
DeleteProxyCacheEntry(ctx context.Context, repoID, cacheKey string) error
DeleteExpiredProxyCacheEntries(ctx context.Context) (int64, error)
// Helm methods
CreateHelmChart(ctx context.Context, chart *models.HelmChart) error
GetHelmChart(ctx context.Context, repoID, name, version string) (*models.HelmChart, error)
DeleteHelmChart(ctx context.Context, repoID, name, version string) error
ListHelmCharts(ctx context.Context, repoID string) ([]*models.HelmChart, error)
// HelmIndexStamp is a cheap validator of a repository's index.yaml: it
// changes exactly when a live chart is added or removed.
HelmIndexStamp(ctx context.Context, repoID string) (string, error)
ListHelmChartVersions(ctx context.Context, repoID, name string) ([]*models.HelmChart, error)
// PyPI methods
CreatePyPIPackage(ctx context.Context, pkg *models.PyPIPackage) error
GetPyPIPackage(ctx context.Context, repoID, name, version, filename string) (*models.PyPIPackage, error)
// GetPyPIPackageByFilename returns the live file with this filename, nil
// when there is none and ErrAmbiguousPyPIFilename when several packages of
// the repository hold a file of that name.
GetPyPIPackageByFilename(ctx context.Context, repoID, filename string) (*models.PyPIPackage, error)
DeletePyPIPackage(ctx context.Context, repoID, name, version, filename string) error
ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
// ListPyPIPackageNames returns the distinct stored project names of a
// repository, sorted, without loading any file row.
ListPyPIPackageNames(ctx context.Context, repoID string) ([]string, error)
ListPyPIPackageVersions(ctx context.Context, repoID, name string) ([]*models.PyPIPackage, error)
// NuGet methods
CreateNuGetPackage(ctx context.Context, pkg *models.NuGetPackage) error
GetNuGetPackage(ctx context.Context, repoID, packageID, version string) (*models.NuGetPackage, error)
DeleteNuGetPackage(ctx context.Context, repoID, packageID, version string) error
// SetNuGetDependencyGroups records the dependency groups JSON of a package
// that has none stored yet (published before they were persisted).
SetNuGetDependencyGroups(ctx context.Context, repoID, packageID, version string, groups []byte) error
ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
ListNuGetPackageVersions(ctx context.Context, repoID, packageID string) ([]*models.NuGetPackage, error)
// SearchNuGetPackages pages over matching packages: skip/take count
// packages, the total is the number of matching packages, and every live
// version of each package on the page is returned.
SearchNuGetPackages(ctx context.Context, repoID, query string, skip, take int) ([]*models.NuGetPackage, int, error)
IncrementNuGetDownloadCount(ctx context.Context, repoID, packageID, version string) error
CreateUser(ctx context.Context, user *models.User) (*models.User, error)
GetUserByID(ctx context.Context, id string) (*models.User, error)
GetUserByUsername(ctx context.Context, username string) (*models.User, error)
UpdateUser(ctx context.Context, user *models.User) error
// UpdateUserLastLogin sets only last_login_at, so a login finishing from a
// stale snapshot cannot undo a concurrent disable or password reset.
UpdateUserLastLogin(ctx context.Context, id string, at time.Time) error
// UpdateUserSSOProfile sets only email (when non-nil), full_name (when
// non-nil) and last_login_at, so an SSO login finishing from a stale
// snapshot cannot undo a concurrent disable or password reset.
UpdateUserSSOProfile(ctx context.Context, id string, email, fullName *string, lastLogin time.Time) error
// UpdateUserPassword sets only password_hash and must_change_password.
UpdateUserPassword(ctx context.Context, id, passwordHash string, mustChange bool) error
ListUsers(ctx context.Context, page, perPage int) ([]*models.User, int, error)
CountUsers(ctx context.Context) (int, error)
// CreateBootstrapAdmin atomically (advisory-locked transaction) creates the first
// admin user and binds it to the admin-all permission target. It reports false
// without creating anything when another replica already created a user.
CreateBootstrapAdmin(ctx context.Context, username, passwordHash string) (bool, error)
// RepairBootstrapAdmin re-binds the bootstrap admin to admin-all when no principal
// holds that target (a previously interrupted bootstrap). Reports whether it repaired.
RepairBootstrapAdmin(ctx context.Context, username string) (bool, error)
CreateGroup(ctx context.Context, group *models.Group) (*models.Group, error)
GetGroupByID(ctx context.Context, id string) (*models.Group, error)
UpdateGroup(ctx context.Context, group *models.Group) error
DeleteGroup(ctx context.Context, id string) error
ListGroups(ctx context.Context) ([]*models.Group, error)
AddUserToGroup(ctx context.Context, userID, groupID string) error
RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
ListGroupsByUser(ctx context.Context, userID string) ([]*models.Group, error)
ListUsersByGroup(ctx context.Context, groupID string) ([]*models.User, error)
CreateSession(ctx context.Context, session *models.Session) (*models.Session, error)
GetSessionByTokenHash(ctx context.Context, hash string) (*models.Session, error)
DeleteSession(ctx context.Context, tokenHash string) error
UpdateSessionLastSeen(ctx context.Context, sessionID string, expiresAt time.Time) error
// ConsumeSAMLAssertion records a SAML assertion ID as used; false means it was
// already consumed (replay).
ConsumeSAMLAssertion(ctx context.Context, providerSlug, assertionID string, expiresAt time.Time) (bool, error)
// DeleteSessionsByUser revokes every session of a user (password change/reset, disable).
DeleteSessionsByUser(ctx context.Context, userID string) error
// DeleteOtherSessionsByUser revokes every session of a user except the one whose
// token hash is keepTokenHash (used on self-service password change).
DeleteOtherSessionsByUser(ctx context.Context, userID, keepTokenHash string) error
CreateToken(ctx context.Context, token *models.Token) (*models.Token, error)
GetTokenByHash(ctx context.Context, hash string) (*models.Token, error)
GetTokenByID(ctx context.Context, tokenID string) (*models.Token, error)
RevokeToken(ctx context.Context, tokenID string) error
UpdateTokenLastUsed(ctx context.Context, tokenID string) error
ListTokensByUser(ctx context.Context, userID string) ([]*models.Token, error)
CreatePermissionTarget(ctx context.Context, target *models.PermissionTarget) (*models.PermissionTarget, error)
GetPermissionTargetByID(ctx context.Context, id string) (*models.PermissionTarget, error)
GetPermissionTargetByName(ctx context.Context, name string) (*models.PermissionTarget, error)
UpdatePermissionTarget(ctx context.Context, target *models.PermissionTarget) error
DeletePermissionTarget(ctx context.Context, id string) error
ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
// ListPermissionAssignments returns every permission assignment (backup export).
ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
// ListUserGroupMemberships returns every user-to-group membership (backup export).
ListUserGroupMemberships(ctx context.Context) ([]*models.UserGroup, error)
CreatePermissionAssignment(ctx context.Context, assignment *models.PermissionAssignment) error
DeletePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
GetPermissionTargetsForPrincipal(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
GetOrCreatePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
SyncSSOPermissionsForGroup(ctx context.Context, groupID string, targetIDs []string) error
CreateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
GetSSOProviderBySlug(ctx context.Context, slug string) (*models.SSOProvider, error)
GetSSOProviderByID(ctx context.Context, id string) (*models.SSOProvider, error)
UpdateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
DeleteSSOProvider(ctx context.Context, id string) error
ListEnabledSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
UpdateUserSSO(ctx context.Context, userID string, externalID, providerSlug string) error
SyncSSOGroups(ctx context.Context, userID string, groupIDs []string) error
GetUserByExternalID(ctx context.Context, externalID, providerSlug string) (*models.User, error)
GetUserByEmail(ctx context.Context, email string) (*models.User, error)
GetGroupByName(ctx context.Context, name string) (*models.Group, error)
GetOrCreateGroup(ctx context.Context, name string) (*models.Group, error)
ArtifactExists(ctx context.Context, sha256 string, repositoryID string) (bool, error)
// ArtifactExistsBySHA256 checks whether a blob with the given SHA-256 hash exists
// in ANY repository. Returns the repository ID of the first match and true if found.
// Use this for cross-repository deduplication: if the blob is already stored,
// the upload pipeline can skip re-uploading it to the blob store.
ArtifactExistsBySHA256(ctx context.Context, sha256 string) (repositoryID string, exists bool, err error)
// BlobReferenceCount returns the number of package-table rows referencing
// the blob identified by sha256, across every format table that stores a
// blob_id FK into the global blobs table. 0 means the blob is a GC
// candidate. Use SafeDeleteBlob (internal/storage/refcount.go) instead of
// calling blobStore.Delete directly.
BlobReferenceCount(ctx context.Context, sha256 string) (int, error)
// BeginBackupSnapshot freezes the database at one instant for a backup and
// registers a lease that keeps the blob bytes that instant references from
// being deleted until Release. The lease is renewed in the background and
// expires leaseTTL after the last renewal, so a crashed backup does not
// hold deletions back forever. See SnapshotReader.
BeginBackupSnapshot(ctx context.Context, leaseTTL time.Duration) (SnapshotReader, error)
// Go Module Proxy methods
CreateGoModule(ctx context.Context, mod *models.GoModule) error
GetGoModule(ctx context.Context, repoID, modulePath, version string) (*models.GoModule, error)
DeleteGoModule(ctx context.Context, repoID, modulePath, version string) error
ListGoModuleVersions(ctx context.Context, repoID, modulePath string) ([]*models.GoModule, error)
// ListGoModulesByRepo is a bulk-list-by-repo method used only by backup
// export (no module path filter required).
ListGoModulesByRepo(ctx context.Context, repoID string) ([]*models.GoModule, error)
InsertAuditLog(ctx context.Context, event *models.AuditLog) error
ListAuditLogs(ctx context.Context, params models.AuditListParams) (*models.AuditPage, error)
ListAllTokens(ctx context.Context, page, perPage int) ([]*models.Token, int, error)
// Cleanup policy methods
CreateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
GetCleanupPolicy(ctx context.Context, id string) (*models.CleanupPolicy, error)
UpdateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
DeleteCleanupPolicy(ctx context.Context, id string) error
ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
ListEnabledCleanupPolicies(ctx context.Context) ([]*models.CleanupPolicy, error)
// ListProjectCleanupPolicies lists a project's default policies (RepositoryID "").
ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
// ListProjectCleanupRepositories lists the live hosted repositories a project
// default policy applies to: those without an enabled repository-level policy.
ListProjectCleanupRepositories(ctx context.Context, projectID string) ([]string, error)
UpdateCleanupPolicyRunResult(ctx context.Context, id string, deletedCount int, runErr error) error
// Webhook methods
CreateWebhook(ctx context.Context, wh *models.Webhook) error
GetWebhook(ctx context.Context, id string) (*models.Webhook, error)
UpdateWebhook(ctx context.Context, wh *models.Webhook) error
DeleteWebhook(ctx context.Context, id string) error
ListWebhooks(ctx context.Context, repoID string) ([]*models.Webhook, error) // repoID="" = global
ListWebhooksForEvent(ctx context.Context, repoID, eventType string) ([]*models.Webhook, error)
CreateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
UpdateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
ListWebhookDeliveries(ctx context.Context, webhookID string, limit int) ([]*models.WebhookDelivery, error)
// ClaimPendingWebhookDeliveries atomically leases up to limit due deliveries
// (FOR UPDATE SKIP LOCKED) so several server instances never share a row.
ClaimPendingWebhookDeliveries(ctx context.Context, limit int, lease time.Duration) ([]*models.WebhookDelivery, error)
// Backup methods
CreateBackupJob(ctx context.Context, job *models.BackupJob) error
GetBackupJob(ctx context.Context, id string) (*models.BackupJob, error)
UpdateBackupJob(ctx context.Context, job *models.BackupJob) error
ListBackupJobs(ctx context.Context, limit int) ([]*models.BackupJob, error)
// Cargo methods
CreateCargoCrate(ctx context.Context, crate *models.CargoCrate) error
GetCargoCrate(ctx context.Context, repoID, name, version string) (*models.CargoCrate, error)
DeleteCargoCrate(ctx context.Context, id string) error
ListCargoCrateVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
// CargoIndexStamp is a cheap validator of one crate's sparse index entry:
// it changes when a live version is added, removed or (un)yanked.
CargoIndexStamp(ctx context.Context, repoID, name string) (string, error)
// ListCargoIndexVersions returns the live versions of a crate with only the
// columns the sparse index needs (Name, Version, MetadataJSON, Checksum,
// Yanked), oldest first.
ListCargoIndexVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
// SearchCargoCrateSummaries matches crates by name or description and
// returns one summary per crate (at most limit, by name) together with the
// total number of matching crates.
SearchCargoCrateSummaries(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrateSummary, int, error)
YankCargoCrate(ctx context.Context, repoID, name, version string, yanked bool) error
IncrementCargoDownloadCount(ctx context.Context, repoID, name, version string) error
// RubyGems methods
CreateRubyGem(ctx context.Context, gem *models.RubyGem) error
GetRubyGem(ctx context.Context, repoID, name, version, platform string) (*models.RubyGem, error)
DeleteRubyGem(ctx context.Context, id string) error
ListRubyGems(ctx context.Context, repoID string) ([]*models.RubyGem, error)
// RubyGemsSpecsStamp is a cheap validator of every specs index of a
// repository: it changes when a listed gem is added, removed or yanked.
RubyGemsSpecsStamp(ctx context.Context, repoID string) (string, error)
// ListRubyGemSpecs returns the listed (not yanked) gems with only Name,
// Version and Platform set, by name then version descending.
ListRubyGemSpecs(ctx context.Context, repoID string) ([]*models.RubyGem, error)
ListRubyGemVersions(ctx context.Context, repoID, name string) ([]*models.RubyGem, error)
SearchRubyGems(ctx context.Context, repoID, query string) ([]*models.RubyGem, error)
YankRubyGem(ctx context.Context, repoID, name, version, platform string, yanked bool) error
// Raw artifact methods
UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
GetRawArtifact(ctx context.Context, repoID, path string) (*models.RawArtifact, error)
DeleteRawArtifact(ctx context.Context, repoID, path string) error
ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
// Presigned uploads (staging rows awaiting their complete call).
// CreatePresignedUpload fills ID and CreatedAt. GetPresignedUpload returns
// nil, nil when the id is unknown or belongs to another repository.
CreatePresignedUpload(ctx context.Context, u *models.PresignedUpload) error
GetPresignedUpload(ctx context.Context, repoID, id string) (*models.PresignedUpload, error)
DeletePresignedUpload(ctx context.Context, id string) error
// ClaimPresignedUpload takes the complete lease of an upload for up to
// lease. It reports false when the upload is already completed or another
// complete holds an unexpired lease.
ClaimPresignedUpload(ctx context.Context, repoID, id string, lease time.Duration) (bool, error)
// ReleasePresignedUpload gives up the lease of an upload that was not completed.
ReleasePresignedUpload(ctx context.Context, id string) error
// MarkPresignedUploadCompleted records that the upload produced artifactID.
MarkPresignedUploadCompleted(ctx context.Context, id, artifactID string) error
// CreatePresignedUploadCapped is CreatePresignedUpload that fails with
// ErrPresignedUploadCap when u.CreatedBy already has maxPending uploads
// that are neither completed nor expired (maxPending <= 0: no cap). The
// count and the insert are serialized per user, so parallel creates cannot
// overshoot the cap.
CreatePresignedUploadCapped(ctx context.Context, u *models.PresignedUpload, maxPending int) error
// ExistingPresignedUploadIDs returns the subset of ids that have a row.
ExistingPresignedUploadIDs(ctx context.Context, ids []string) ([]string, error)
ListExpiredPresignedUploads(ctx context.Context, limit int) ([]string, error)
// SBOM methods
CreateSBOMReport(ctx context.Context, report *models.SBOMReport) error
GetSBOMReport(ctx context.Context, repoID, artifactID, format, specVersion string) (*models.SBOMReport, error)
ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
DeleteSBOMReport(ctx context.Context, id string) error
// License compliance methods
CreateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
GetLicenseScanResult(ctx context.Context, repoID, artifactID string) (*models.LicenseScanResult, error)
UpdateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
CreateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
GetLicensePolicy(ctx context.Context, id string) (*models.LicensePolicy, error)
UpdateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
DeleteLicensePolicy(ctx context.Context, id string) error
ListLicensePolicies(ctx context.Context, repoID string) ([]*models.LicensePolicy, error)
// Secret detection methods
CreateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
GetSecretScanResult(ctx context.Context, repoID, artifactID string) (*models.SecretScanResult, error)
UpdateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
QuarantineArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
// Vulnerability scanning methods
CreateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
GetVulnScanResult(ctx context.Context, repoID, artifactID string) (*models.VulnScanResult, error)
UpdateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
QuarantineVulnArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
// Storage quota methods
// GetProjectQuota returns the project's storage ceiling (unlimited when never set).
GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
// SetProjectQuota stores the ceiling (0 = unlimited) and initialises the
// counters from the repository counters when a limit is first enabled.
SetProjectQuota(ctx context.Context, projectID string, maxSizeBytes, maxArtifactCount int64, warnThresholdPercent int) (*models.ProjectQuota, error)
// GetProjectUsage sums the repository counters of a project and lists them per repository.
GetProjectUsage(ctx context.Context, projectID string) (*models.ProjectUsage, error)
GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
UpdateStorageQuota(ctx context.Context, quota *models.StorageQuota) error
// ListStorageQuotas returns the limits of every repository quota row (backup export).
ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
IncrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
DecrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
// ReserveStorageUsage atomically adds usage if it fits the quota; false,nil when exceeded.
ReserveStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) (bool, error)
// ReconcileStorageUsage recomputes one repository's usage counters from its
// package rows (sum of blob sizes, one artifact per row) and returns the
// corrected quota.
ReconcileStorageUsage(ctx context.Context, repoID string) (*models.StorageQuota, error)
// ReconcileAllStorageUsage does the same for every repository and returns how
// many counters it had to correct. Concurrent callers (other replicas) are
// serialized: a caller that finds a run in progress returns 0, nil.
ReconcileAllStorageUsage(ctx context.Context) (int64, error)
// Storage backends
CreateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
UpdateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
DeleteStorageBackend(ctx context.Context, id string) error
CountBlobsOnStorageBackend(ctx context.Context, backendID string) (int64, error)
// StorageBackendBusyReason says why a backend must not change kind/config ("" = idle).
StorageBackendBusyReason(ctx context.Context, backendID string) (string, error)
UpdateStorageBackendStatus(ctx context.Context, id, status string, message *string) error
// Artifact properties methods
SetArtifactProperty(ctx context.Context, repoID, artifactID, key, value string) error
GetArtifactProperty(ctx context.Context, repoID, artifactID, key string) (string, error)
DeleteArtifactProperty(ctx context.Context, repoID, artifactID, key string) error
ListArtifactProperties(ctx context.Context, repoID, artifactID string) (map[string]string, error)
SearchByProperty(ctx context.Context, repoID, key, value string) ([]string, error)
// Package delta methods
CreatePackageDelta(ctx context.Context, delta *models.PackageDelta) error
GetPackageDelta(ctx context.Context, repoID, fromSHA256, toSHA256 string) (*models.PackageDelta, error)
ListPackageDeltas(ctx context.Context, repoID, toSHA256 string) ([]*models.PackageDelta, error)
DeletePackageDelta(ctx context.Context, id string) error
// Project methods
CreateProject(ctx context.Context, project *models.Project) error
GetProject(ctx context.Context, id string) (*models.Project, error)
GetProjectByName(ctx context.Context, name string) (*models.Project, error)
UpdateProject(ctx context.Context, project *models.Project) error
DeleteProject(ctx context.Context, id string) error
// ListProjects returns the projects the user belongs to (recorded owner,
// member, or through a group).
ListProjects(ctx context.Context, userID string) ([]*models.Project, error)
ListAllProjects(ctx context.Context) ([]*models.Project, error)
AddProjectMember(ctx context.Context, projectID, userID, role string) error
ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
GetProjectMember(ctx context.Context, projectID, userID string) (*models.ProjectMember, error)
// ChangeProjectMember sets, adds or removes (newRole "") a member's role
// under the project row lock; guard vetoes the change (see ProjectRoleGuard).
ChangeProjectMember(ctx context.Context, projectID, userID, newRole string, guard ProjectRoleGuard) error
// ChangeProjectGroup attaches, changes or detaches (newRole "") a group the same way.
ChangeProjectGroup(ctx context.Context, projectID, groupID, newRole string, createdBy *string, guard ProjectRoleGuard) error
// ListProjectRepositories returns one page of the project's live repositories and their total.
ListProjectRepositories(ctx context.Context, projectID string, page, limit int) ([]*models.Repository, int, error)
// CountRepositoriesByProject returns the live repository count per project ID.
CountRepositoriesByProject(ctx context.Context, projectIDs []string) (map[string]int, error)
// CreateProjectToken mints a project token: service user, membership and
// deploy token in one transaction (ErrProjectTokenLimit, ErrProjectTokenName).
CreateProjectToken(ctx context.Context, spec ProjectTokenSpec) (*models.Token, error)
// ListProjectTokens returns the project's active tokens; createdBy limits them to one creator.
ListProjectTokens(ctx context.Context, projectID string, createdBy *string) ([]*models.Token, error)
// RevokeProjectToken revokes a token of the project and disables its service user; false when there is none.
RevokeProjectToken(ctx context.Context, projectID, tokenID string) (bool, error)
ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
GetProjectGroup(ctx context.Context, projectID, groupID string) (*models.ProjectGroup, error)
// SetProjectGroup attaches a group with role, or changes an existing role,
// without any guard (backup restore); API changes use ChangeProjectGroup.
SetProjectGroup(ctx context.Context, projectID, groupID, role string, createdBy *string) error
// ListProjectGrantsByUser returns every project role the user holds:
// recorded owner, membership rows and group attachments, one grant per
// source (cached like the other per-request auth lookups).
ListProjectGrantsByUser(ctx context.Context, userID string) ([]*models.ProjectGrant, error)
// System settings methods
GetSystemSetting(ctx context.Context, key string) (string, error)
SetSystemSetting(ctx context.Context, key, value string) error
// Conda methods
CreateCondaPackage(ctx context.Context, pkg *models.CondaPackage) error
// GetCondaPackageFile returns the live package file with exactly this
// name, version, build, platform and extension (".tar.bz2" or ".conda").
GetCondaPackageFile(ctx context.Context, repoID, name, version, buildString, platform, extension string) (*models.CondaPackage, error)
DeleteCondaPackage(ctx context.Context, id string) error
ListCondaPackages(ctx context.Context, repoID, platform string) ([]*models.CondaPackage, error)
// CondaRepodataStamp is a cheap validator of one platform's repodata.json:
// it changes exactly when a live package is added or removed.
CondaRepodataStamp(ctx context.Context, repoID, platform string) (string, error)
// ListAllCondaPackages is a bulk-list-by-repo method used only by backup
// export (no platform filter required).
ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
// Conan methods. A conan_packages row is one stored file of a recipe or
// package revision.
//
// CreateConanPackage stores the file, replacing the blob of the live row with
// the same key. GetConanPackage returns (nil, nil) when there is none.
CreateConanPackage(ctx context.Context, pkg *models.ConanPackage) error
GetConanPackage(ctx context.Context, repoID string, key models.ConanFileKey) (*models.ConanPackage, error)
// ListConanRecipeFiles returns every live file of one recipe: all its recipe
// and package revisions.
ListConanRecipeFiles(ctx context.Context, repoID, name, version, userChannel string) ([]*models.ConanPackage, error)
// ListConanRecipes returns the distinct recipes of a repository.
ListConanRecipes(ctx context.Context, repoID string) ([]models.ConanRecipe, error)
DeleteConanPackage(ctx context.Context, id string) error
ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
// Ivy methods
CreateIvyArtifact(ctx context.Context, artifact *models.IvyArtifact) error
GetIvyArtifact(ctx context.Context, repoID, organisation, module, revision, artifactName, artifactExt string) (*models.IvyArtifact, error)
DeleteIvyArtifact(ctx context.Context, id string) error
ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
// SBT methods
CreateSBTArtifact(ctx context.Context, artifact *models.SBTArtifact) error
GetSBTArtifact(ctx context.Context, repoID, groupID, artifactID, version, filename string) (*models.SBTArtifact, error)
DeleteSBTArtifact(ctx context.Context, id string) error
ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
// Release bundle and promotion pipeline methods
CreatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
GetPromotionPipelineByName(ctx context.Context, name string) (*models.PromotionPipeline, error)
GetPromotionPipelineByID(ctx context.Context, id string) (*models.PromotionPipeline, error)
UpdatePromotionPipeline(ctx context.Context, p *models.PromotionPipeline) error
DeletePromotionPipeline(ctx context.Context, id string) error
ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
CreateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
GetReleaseBundle(ctx context.Context, name, version string) (*models.ReleaseBundle, error)
GetReleaseBundleByID(ctx context.Context, id string) (*models.ReleaseBundle, error)
UpdateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
DeleteReleaseBundle(ctx context.Context, id string) error
ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
AddBundleItem(ctx context.Context, item *models.ReleaseBundleItem) error
// RemoveBundleItem deletes an item of a draft bundle (ErrBundleNotDraft otherwise).
RemoveBundleItem(ctx context.Context, bundleID, sha256 string) error
ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
GetBundleItem(ctx context.Context, bundleID, sha256 string) (*models.ReleaseBundleItem, error)
CreateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
UpdateBundlePromotion(ctx context.Context, p *models.BundlePromotion) error
ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
// AddBundleItems atomically adds items to a draft bundle (ErrBundleNotDraft otherwise).
AddBundleItems(ctx context.Context, bundleID string, items []*models.ReleaseBundleItem) error
// SealReleaseBundle conditionally moves a non-empty draft bundle to sealed; false when it was not a draft.
SealReleaseBundle(ctx context.Context, bundleID, sealedBy string, sealedAt time.Time) (bool, error)
// Scan lookups/deletes by ID scoped to a repository (nil / not-found errors when absent).
GetVulnScanResultByID(ctx context.Context, repoID, id string) (*models.VulnScanResult, error)
DeleteVulnScanResult(ctx context.Context, repoID, id string) error
// ListVulnScanOverview returns one keyset page of vulnerability scans across all
// repositories, worst first, without their findings (ErrInvalidVulnScanFilter
// for an unknown severity, status or scanner or a page size below 1).
ListVulnScanOverview(ctx context.Context, params models.VulnScanListParams) (*models.VulnScanOverviewPage, error)
// VulnScanOverviewSummary counts the overview's scans, optionally of one repository (by name).
VulnScanOverviewSummary(ctx context.Context, repoName string) (*models.VulnScanSummary, error)
SetVulnScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
GetLicenseScanResultByID(ctx context.Context, repoID, id string) (*models.LicenseScanResult, error)
// SetLicenseScanQuarantine quarantines (true) or approves (false) the artifact of one license scan result.
SetLicenseScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
ListGlobalLicensePolicies(ctx context.Context) ([]*models.LicensePolicy, error)
GetSBOMReportByID(ctx context.Context, repoID, id string) (*models.SBOMReport, error)
// UpsertVEXStatement records or replaces the admin VEX decision for (repo, artifact, vuln) and fills the stored row back.
UpsertVEXStatement(ctx context.Context, s *models.VEXStatement) error
// ListVEXStatements lists a repository's VEX decisions, only one artifact's when artifactID != "".
ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
// DeleteVEXStatement deletes a decision scoped to repoID; ErrVEXStatementNotFound when absent.
DeleteVEXStatement(ctx context.Context, repoID, id string) error
// DeleteSBOMReportInRepo deletes the report and returns the sha256 of its blob ("" if none).
DeleteSBOMReportInRepo(ctx context.Context, repoID, id string) (string, error)
// SetArtifactProperties upserts props in one transaction; replace=true clears existing ones first.
SetArtifactProperties(ctx context.Context, repoID, artifactID string, props map[string]string, replace bool) error
// AI analysis methods
UpsertAIAnalysis(ctx context.Context, analysis *models.AIAnalysis) error
GetAIAnalysis(ctx context.Context, repoID, artifactID string) (*models.AIAnalysis, error)
ListAIAnalyses(ctx context.Context, repoID string, status string, licenseReviewOnly bool, limit, offset int) ([]*models.AIAnalysis, int, error)
DeleteAIAnalysis(ctx context.Context, repoID, artifactID string) error
ListPendingAIAnalyses(ctx context.Context, limit int) ([]*models.AIAnalysis, error)
}
Database defines the interface for database operations.
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `yaml:"driver"` // "postgres", "mysql", "sqlite"
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
Database string `yaml:"database"`
SSLMode string `yaml:"sslMode"` // For PostgreSQL
Options map[string]string `yaml:"options"`
MaxOpenConns int `yaml:"maxOpenConns"` // Maximum number of open connections (default: 25)
MaxIdleConns int `yaml:"maxIdleConns"` // Maximum number of idle connections (default: 5)
ConnMaxLifetimeMinutes int `yaml:"connMaxLifetimeMinutes"` // Maximum lifetime of a connection in minutes (default: 30)
// AuthCacheTTLMillis is how long per-request authentication lookups (token,
// user, groups, permission targets, repository by name) are served from
// memory. Writes through this process invalidate immediately; other
// replicas observe a change after at most this long. 0 disables the cache.
AuthCacheTTLMillis int `yaml:"authCacheTtlMs"`
// ConnectTimeout is how long startup keeps retrying the initial database
// connection (capped exponential backoff) before giving up. 0 fails at the
// first error.
ConnectTimeout time.Duration `yaml:"connectTimeout"`
}
DatabaseConfig contains database connection configuration.
type DockerBlobImages ¶ added in v0.5.0
type DockerBlobImages interface {
// DockerBlobVisible reports whether the image may serve and reference the
// blob: it is linked to the image, or it predates image links and has none.
DockerBlobVisible(ctx context.Context, repoID, image, digest string) (bool, error)
// LinkDockerBlob links a blob the repository holds to the image.
LinkDockerBlob(ctx context.Context, repoID, image, digest string) error
}
DockerBlobImages is implemented by databases that track which images of a repository a blob belongs to, so RBAC path_pattern scoped to one image also scopes the blob digests it can read and reference.
type DockerBlobToucher ¶ added in v0.4.0
type DockerBlobToucher interface {
// TouchDockerBlob records a use of the blob and reports false when the
// repository no longer has it.
TouchDockerBlob(ctx context.Context, repoID, digest string) (bool, error)
}
DockerBlobToucher is implemented by databases that track when a registry blob was last used, so registry GC keeps recently used blobs.
type DockerGCStore ¶ added in v0.4.0
type DockerGCStore interface {
// ListUnindexedDockerManifests returns up to limit manifests of the
// repository whose references have not been recorded yet.
ListUnindexedDockerManifests(ctx context.Context, repoID string, limit int) ([]*models.DockerGCManifest, error)
// SetDockerManifestRefs records the references of a manifest body and marks
// the manifest indexed. A manifest deleted meanwhile is skipped silently.
SetDockerManifestRefs(ctx context.Context, repoID string, m *models.DockerGCManifest, refs models.DockerManifestRefs) error
// ListDockerGCManifests returns every live manifest of the repository with its
// tagged/young flags (young: pushed within grace) and index children.
ListDockerGCManifests(ctx context.Context, repoID string, grace time.Duration) ([]*models.DockerGCManifest, error)
// DeleteDockerManifestsForGC deletes the given manifests (by row id) that
// are still older than grace, untagged and not adjacent to a manifest
// outside ids, and returns the ones actually deleted.
DeleteDockerManifestsForGC(ctx context.Context, repoID string, ids []string, grace time.Duration) ([]*models.DockerGCManifest, error)
// ListDockerGCBlobs returns up to limit blob records of the repository that
// no manifest other than excludeManifestIDs references and that have not
// been used within grace.
ListDockerGCBlobs(ctx context.Context, repoID string, grace time.Duration, excludeManifestIDs []string, limit int) ([]*models.DockerGCBlob, error)
// DeleteDockerBlobsForGC deletes the given blob records (by digest) that are
// still unreferenced and unused within grace, and returns the ones actually
// deleted. The caller removes the underlying blobs with storage.SafeDeleteBlob.
DeleteDockerBlobsForGC(ctx context.Context, repoID string, digests []string, grace time.Duration) ([]*models.DockerGCBlob, error)
// BlobRowExists reports whether the global blobs table still has sha256.
BlobRowExists(ctx context.Context, sha256 string) (bool, error)
}
DockerGCStore is the storage side of Docker registry garbage collection (internal/worker.DockerGCWorker). PostgresDB implements it; the worker reports GC as unsupported for databases that do not.
Soft-deleted (trashed) manifests are not GC candidates (purge removes them), but their recorded references keep counting: layers and child manifests that a trashed manifest references are never collected, and a live manifest that a trashed tag points at stays "tagged" until that tag is purged, so restoring from the trash never yields a dangling reference.
Mutations take the repository's exclusive docker lock for the length of one transaction. CreateDockerManifest takes the same lock shared, so a push either completes before a GC transaction starts (and its references are then visible to it) or starts after it ends.
type DockerUploadSweepStore ¶ added in v0.5.0
type DockerUploadSweepStore interface {
DeleteStaleDockerUploads(ctx context.Context, cutoff time.Time) ([]string, error)
}
DockerUploadSweepStore is implemented by PostgresDB; the upload sweeper reports itself unsupported for databases that do not.
type GomodAffectedRow ¶ added in v0.5.0
type GomodAffectedRow struct {
ID string
RepositoryID string
RepoName string
ModulePath string
Version string
GoModContent string
Trashed bool
// BadBlobID and BadBlobKey identify the invalid blobs row the zip points at.
BadBlobID string
BadBlobKey string
}
GomodAffectedRow is a gomod_modules row (trashed ones included) whose zip blob row has an invalid sha256.
type LiveSnapshot ¶ added in v0.7.0
type LiveSnapshot struct {
Database
Blobs []BlobRow
// OnRelease, when set, runs on Release (tests assert the snapshot is ended).
OnRelease func()
}
LiveSnapshot adapts an in-memory Database to SnapshotReader for tests: reads go straight to the wrapped database (an in-memory fake is trivially consistent) and the blobs table is the Blobs slice, which the test keeps sorted by sha256. A fake's BeginBackupSnapshot returns one of these.
func (*LiveSnapshot) CountBlobs ¶ added in v0.7.0
func (s *LiveSnapshot) CountBlobs(context.Context) (int64, error)
CountBlobs returns len(Blobs).
func (*LiveSnapshot) ListBlobsAfter ¶ added in v0.7.0
func (s *LiveSnapshot) ListBlobsAfter(_ context.Context, after string, limit int) ([]BlobRow, error)
ListBlobsAfter returns the next page of Blobs.
func (*LiveSnapshot) Release ¶ added in v0.7.0
func (s *LiveSnapshot) Release()
Release runs OnRelease.
type MigrationStatus ¶
MigrationStatus describes the state of a single migration file.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator applies embedded SQL migrations to a PostgreSQL database.
func NewMigrator ¶
NewMigrator returns a Migrator backed by the embedded migrations FS.
func NewMigratorWithFS ¶
NewMigratorWithFS returns a Migrator using a custom FS, intended for testing.
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
PostgresDB implements the Database interface for PostgreSQL.
func NewPostgresDB ¶
func NewPostgresDB(cfg DatabaseConfig, log *logger.Logger) (*PostgresDB, error)
func (*PostgresDB) AddBundleItem ¶
func (p *PostgresDB) AddBundleItem(ctx context.Context, item *models.ReleaseBundleItem) error
AddBundleItem inserts a bundle item. release_bundle_items has no component_id column, so item.ComponentID never round-trips through storage. The adder is stored as an adder_id UUID FK resolved from AddedBy (username) via a scalar subquery.
func (*PostgresDB) AddBundleItems ¶ added in v0.2.0
func (p *PostgresDB) AddBundleItems(ctx context.Context, bundleID string, items []*models.ReleaseBundleItem) error
AddBundleItems inserts all items atomically. The bundle row is locked and must be in draft state; otherwise ErrBundleNotDraft / ErrBundleNotFound is returned and nothing is inserted. Items whose (bundle_id, sha256) already exists are skipped. Each item's ID is filled in.
func (*PostgresDB) AddGroupMember ¶
func (*PostgresDB) AddProjectMember ¶ added in v0.6.0
func (p *PostgresDB) AddProjectMember(ctx context.Context, projectID, userID, role string) error
func (*PostgresDB) AddUserToGroup ¶
func (p *PostgresDB) AddUserToGroup(ctx context.Context, userID, groupID string) error
func (*PostgresDB) ArtifactExists ¶
func (*PostgresDB) ArtifactExistsBySHA256 ¶
func (p *PostgresDB) ArtifactExistsBySHA256(ctx context.Context, sha256 string) (string, bool, error)
ArtifactExistsBySHA256 checks whether a blob with the given SHA-256 hash exists in any repository. Returns the repository ID of the first match.
func (*PostgresDB) AuthCacheGeneration ¶ added in v0.7.0
func (p *PostgresDB) AuthCacheGeneration() uint64
AuthCacheGeneration changes whenever a write made through this PostgresDB invalidated the auth cache. A value derived from permission data is current only while the generation read before deriving it is unchanged. It never changes while the cache is disabled (TTL 0).
func (*PostgresDB) AuthCacheTTL ¶ added in v0.7.0
func (p *PostgresDB) AuthCacheTTL() time.Duration
AuthCacheTTL is the configured lifetime of auth-derived cache entries (0: caching disabled). Other caches that derive from the same permission data, such as the search handler's readable-repository sets, follow it.
func (*PostgresDB) BeginBackupSnapshot ¶ added in v0.7.0
func (p *PostgresDB) BeginBackupSnapshot(ctx context.Context, leaseTTL time.Duration) (SnapshotReader, error)
BeginBackupSnapshot registers a backup lease and freezes the database. See SnapshotReader. The lease is renewed in the background until Release; if the process dies, it simply expires after leaseTTL and deferred blob deletions resume. The caller's ctx must outlive the backup: its cancellation ends the snapshot.
func (*PostgresDB) BeginStorageTierMove ¶ added in v0.7.0
func (p *PostgresDB) BeginStorageTierMove(ctx context.Context, m *models.StorageTierMove) (*models.StorageTierMove, bool, error)
BeginStorageTierMove journals the start of a move. It returns the journal row that is now authoritative for the blob and whether this call created it; an existing row (a move in flight or one awaiting cleanup) is returned as is.
func (*PostgresDB) BeginTx ¶
func (p *PostgresDB) BeginTx(ctx context.Context) (Transaction, error)
BeginTx starts a new transaction.
func (*PostgresDB) BlobDeletionDue ¶ added in v0.7.0
BlobDeletionDue reports whether the queued deletion may run right now: it exists, its grace period has passed and no live backup lease still needs the bytes. The sweeper asks again after taking the per-blob lock, because the blob may have been deleted once more (a newer deletion a backup still sees) since it was claimed.
func (*PostgresDB) BlobReferenceCount ¶
BlobReferenceCount returns the number of rows, across every package table that stores a blob_id FK into the global blobs table, referencing the blob identified by sha256. A count of 0 means the blob is safe to delete from storage (see SafeDeleteBlob in internal/storage/refcount.go). A blob that does not exist in the blobs table is still checked against the tables that reference storage objects by sha256 alone (generated metadata, deltas, release bundles, proxy cache).
func (*PostgresDB) BlobRowExists ¶ added in v0.4.0
func (*PostgresDB) CargoIndexStamp ¶ added in v0.6.0
func (*PostgresDB) ChangeProjectGroup ¶ added in v0.6.0
func (p *PostgresDB) ChangeProjectGroup(ctx context.Context, projectID, groupID, newRole string, createdBy *string, guard ProjectRoleGuard) error
ChangeProjectGroup attaches a group with newRole, changes its role, or detaches it (newRole == ""), in one transaction that holds the project row lock; the guard sees the group's current role ("" when not attached).
func (*PostgresDB) ChangeProjectMember ¶ added in v0.6.0
func (p *PostgresDB) ChangeProjectMember(ctx context.Context, projectID, userID, newRole string, guard ProjectRoleGuard) error
ChangeProjectMember sets, adds or removes (newRole == "") a user's project role in one transaction that holds the project row lock, so the guard, the recorded-owner and last-owner checks and the write see one consistent state and concurrent changes serialize. The guard runs first; then the invariants ErrProjectOwnerLocked and ErrLastProjectOwner apply.
func (*PostgresDB) ClaimBlobDeletions ¶ added in v0.7.0
func (p *PostgresDB) ClaimBlobDeletions(ctx context.Context, limit int, claimFor time.Duration) ([]BlobDeletion, error)
ClaimBlobDeletions hands out up to limit deletions that are due. A claimed row is invisible to other callers for claimFor (so two sweepers never take the same one, and a crashed sweeper's rows come back).
func (*PostgresDB) ClaimPendingWebhookDeliveries ¶ added in v0.2.0
func (p *PostgresDB) ClaimPendingWebhookDeliveries(ctx context.Context, limit int, lease time.Duration) ([]*models.WebhookDelivery, error)
ClaimPendingWebhookDeliveries atomically claims up to limit due deliveries (pending, next_retry_at unset or elapsed) for lease: it pushes their next_retry_at to the end of the lease under FOR UPDATE SKIP LOCKED, so concurrent pollers on any number of server instances never receive the same row. A claimed delivery that is never completed becomes claimable again once the lease expires.
func (*PostgresDB) ClaimPresignedUpload ¶ added in v0.5.0
func (p *PostgresDB) ClaimPresignedUpload(ctx context.Context, repoID, id string, lease time.Duration) (bool, error)
ClaimPresignedUpload takes the complete lease of an upload for up to lease. It reports false when the upload is already completed, does not exist, or another complete holds an unexpired lease.
func (*PostgresDB) CondaRepodataStamp ¶ added in v0.6.0
func (*PostgresDB) ConsumeSAMLAssertion ¶ added in v0.2.0
func (p *PostgresDB) ConsumeSAMLAssertion(ctx context.Context, providerSlug, assertionID string, expiresAt time.Time) (bool, error)
ConsumeSAMLAssertion records a SAML assertion ID as used and reports whether this call was the first to consume it. A false result means the assertion was already accepted before (replay). Expired records are purged opportunistically.
func (*PostgresDB) CountBlobDeletions ¶ added in v0.7.0
func (p *PostgresDB) CountBlobDeletions(ctx context.Context) (int64, error)
CountBlobDeletions returns how many deletions are queued.
func (*PostgresDB) CountBlobsOnStorageBackend ¶ added in v0.2.0
func (p *PostgresDB) CountBlobsOnStorageBackend(ctx context.Context, backendID string) (int64, error)
CountBlobsOnStorageBackend returns how many blobs are recorded on a storage backend.
func (*PostgresDB) CountRepositories ¶
func (*PostgresDB) CountRepositoriesByProject ¶ added in v0.6.0
func (p *PostgresDB) CountRepositoriesByProject(ctx context.Context, projectIDs []string) (map[string]int, error)
CountRepositoriesByProject returns the number of live repositories per project for the given project IDs (projects without any are absent).
func (*PostgresDB) CountStorageTierMoves ¶ added in v0.7.0
func (p *PostgresDB) CountStorageTierMoves(ctx context.Context) (int64, error)
CountStorageTierMoves counts the journal rows (moves in flight or awaiting cleanup).
func (*PostgresDB) CountUsers ¶
func (p *PostgresDB) CountUsers(ctx context.Context) (int, error)
func (*PostgresDB) CreateBackupJob ¶
CreateBackupJob creates a new backup job.
func (*PostgresDB) CreateBootstrapAdmin ¶ added in v0.2.0
func (p *PostgresDB) CreateBootstrapAdmin(ctx context.Context, username, passwordHash string) (bool, error)
CreateBootstrapAdmin creates the first admin user and binds it to the admin-all permission target in one transaction guarded by an advisory lock. It returns false (and creates nothing) when a user already exists, which is what a replica that lost the first-boot race observes.
func (*PostgresDB) CreateBundlePromotion ¶
func (p *PostgresDB) CreateBundlePromotion(ctx context.Context, pr *models.BundlePromotion) error
func (*PostgresDB) CreateCargoCrate ¶
func (p *PostgresDB) CreateCargoCrate(ctx context.Context, crate *models.CargoCrate) error
CreateCargoCrate creates a new Cargo crate.
cargo_crates has no size_bytes column; the crate blob row takes its size from crate.SizeBytes.
func (*PostgresDB) CreateCleanupPolicy ¶
func (p *PostgresDB) CreateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
CreateCleanupPolicy creates a new cleanup policy.
func (*PostgresDB) CreateComponent ¶
func (*PostgresDB) CreateConanPackage ¶
func (p *PostgresDB) CreateConanPackage(ctx context.Context, pkg *models.ConanPackage) error
CreateConanPackage stores one Conan file, replacing the blob of the live row with the same (recipe revision, package id, package revision, filename).
conan_packages.blob_id is nullable; rows restored from a backup that predates the sha256 field carry only the blob key, which then stands in for the digest.
func (*PostgresDB) CreateCondaPackage ¶
func (p *PostgresDB) CreateCondaPackage(ctx context.Context, pkg *models.CondaPackage) error
CreateCondaPackage creates a new Conda package file. An empty pkg.Extension is stored as ".tar.bz2" and an empty pkg.Extra as "{}". A live row for the same (name, version, build, platform, extension) yields ErrDuplicate and is left untouched.
func (*PostgresDB) CreateDebPackage ¶
func (p *PostgresDB) CreateDebPackage(ctx context.Context, pkg *models.Component, distID, compID string) error
CreateDebPackage inserts a DEB package with distribution and component references.
func (*PostgresDB) CreateDebianArchitecture ¶
func (p *PostgresDB) CreateDebianArchitecture(ctx context.Context, arch *models.DebianArchitecture) error
func (*PostgresDB) CreateDebianComponent ¶
func (p *PostgresDB) CreateDebianComponent(ctx context.Context, comp *models.DebianComponent) error
func (*PostgresDB) CreateDebianDistribution ¶
func (p *PostgresDB) CreateDebianDistribution(ctx context.Context, dist *models.DebianDistribution) error
func (*PostgresDB) CreateDockerBlob ¶
func (p *PostgresDB) CreateDockerBlob(ctx context.Context, blob *models.DockerBlob) error
CreateDockerBlob upserts the blob's content into the global blobs table (docker_blobs.blob_id FKs into blobs, which holds the media type, size and sha256) and inserts the per-repo docker_blobs registry row referencing it. blob.Inserted reports whether the repository's row is new (false: it already held the blob).
func (*PostgresDB) CreateDockerManifest ¶
func (p *PostgresDB) CreateDockerManifest(ctx context.Context, m *models.DockerManifest) error
CreateDockerManifest upserts the manifest row. When m.Refs is set, the references of the manifest body are recorded in the same transaction, under the shared per-repository docker lock that registry GC takes exclusively before it deletes anything: GC then sees either none of this push or all of it, never a manifest whose references it cannot see yet. m.Inserted reports whether the live row is new (false: a re-push refreshed the existing one).
func (*PostgresDB) CreateDockerUpload ¶
func (p *PostgresDB) CreateDockerUpload(ctx context.Context, upload *models.DockerUpload) error
func (*PostgresDB) CreateGoModule ¶
CreateGoModule creates a new Go module record.
gomod_modules stores two blobs (zip archive + go.mod file) via zip_blob_id/ mod_blob_id FKs into the global blobs table. The mod blob has no dedicated hash field on models.GoModule, so its own blob key is used as the blobs.sha256 value (self-referential, mirrors the docker blob pattern) — it never collides since blob keys are unique per upload.
func (*PostgresDB) CreateGroup ¶
func (*PostgresDB) CreateHelmChart ¶
CreateHelmChart creates a new Helm chart.
func (*PostgresDB) CreateIvyArtifact ¶
func (p *PostgresDB) CreateIvyArtifact(ctx context.Context, artifact *models.IvyArtifact) error
CreateIvyArtifact stores an Ivy artifact; a live artifact with the same coordinates is repointed at the new blob.
func (*PostgresDB) CreateLicensePolicy ¶
func (p *PostgresDB) CreateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
CreateLicensePolicy creates a new license policy.
func (*PostgresDB) CreateLicenseScanResult ¶
func (p *PostgresDB) CreateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
CreateLicenseScanResult creates a new license scan result (UPSERT).
func (*PostgresDB) CreateMavenArtifact ¶
func (p *PostgresDB) CreateMavenArtifact(ctx context.Context, a *models.MavenArtifact) error
func (*PostgresDB) CreateNPMPackage ¶
func (p *PostgresDB) CreateNPMPackage(ctx context.Context, pkg *models.NPMPackage) (*models.NPMPackage, error)
func (*PostgresDB) CreateNPMVersion ¶
func (p *PostgresDB) CreateNPMVersion(ctx context.Context, v *models.NPMVersion) (*models.NPMVersion, error)
func (*PostgresDB) CreateNuGetPackage ¶
func (p *PostgresDB) CreateNuGetPackage(ctx context.Context, pkg *models.NuGetPackage) error
func (*PostgresDB) CreatePackageDelta ¶
func (p *PostgresDB) CreatePackageDelta(ctx context.Context, d *models.PackageDelta) error
func (*PostgresDB) CreatePermissionAssignment ¶
func (p *PostgresDB) CreatePermissionAssignment(ctx context.Context, assignment *models.PermissionAssignment) error
func (*PostgresDB) CreatePermissionTarget ¶
func (p *PostgresDB) CreatePermissionTarget(ctx context.Context, target *models.PermissionTarget) (*models.PermissionTarget, error)
func (*PostgresDB) CreatePresignedUpload ¶ added in v0.5.0
func (p *PostgresDB) CreatePresignedUpload(ctx context.Context, u *models.PresignedUpload) error
CreatePresignedUpload records a presigned upload and fills u.ID and u.CreatedAt.
func (*PostgresDB) CreatePresignedUploadCapped ¶ added in v0.5.0
func (p *PostgresDB) CreatePresignedUploadCapped(ctx context.Context, u *models.PresignedUpload, maxPending int) error
CreatePresignedUploadCapped counts the user's outstanding uploads and inserts the new one in one transaction holding a per-user advisory lock, so parallel creates cannot all pass the check before any of them inserts.
func (*PostgresDB) CreateProject ¶ added in v0.6.0
func (*PostgresDB) CreateProjectRepository ¶ added in v0.6.0
func (p *PostgresDB) CreateProjectRepository(ctx context.Context, repo *models.Repository, memberIDs []string, maxRepositories int) error
CreateProjectRepository is CreateRepositoryWithMembers under the project's repository cap: with the project row locked it refuses (ErrProjectRepoLimit) when the project already holds maxRepositories live repositories, so concurrent creations cannot overshoot the cap.
func (*PostgresDB) CreateProjectToken ¶ added in v0.6.0
func (p *PostgresDB) CreateProjectToken(ctx context.Context, spec ProjectTokenSpec) (*models.Token, error)
CreateProjectToken creates, in one transaction that holds the project row lock, the service user, its membership with the token's role and the deploy token. It returns ErrProjectNotFound, ErrProjectTokenLimit or ErrProjectTokenName when the token cannot be minted.
func (*PostgresDB) CreatePromotionPipeline ¶
func (p *PostgresDB) CreatePromotionPipeline(ctx context.Context, pp *models.PromotionPipeline) error
func (*PostgresDB) CreatePyPIPackage ¶
func (p *PostgresDB) CreatePyPIPackage(ctx context.Context, pkg *models.PyPIPackage) error
func (*PostgresDB) CreateRPMRepo ¶
func (*PostgresDB) CreateReleaseBundle ¶
func (p *PostgresDB) CreateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
func (*PostgresDB) CreateRepository ¶
func (p *PostgresDB) CreateRepository(ctx context.Context, repo *models.Repository) error
func (*PostgresDB) CreateRepositoryWithMembers ¶ added in v0.2.0
func (p *PostgresDB) CreateRepositoryWithMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
CreateRepositoryWithMembers inserts a repository and (for group repos) its ordered member list in a single transaction, so a failing member insert cannot leave a half-created group behind.
func (*PostgresDB) CreateRpmPackage ¶
CreateRpmPackage inserts an RPM package.
func (*PostgresDB) CreateRubyGem ¶
CreateRubyGem creates a new RubyGem.
gem.Size is persisted on the row (for quota release) and recorded as the blob's size_bytes.
func (*PostgresDB) CreateSBOMReport ¶
func (p *PostgresDB) CreateSBOMReport(ctx context.Context, report *models.SBOMReport) error
CreateSBOMReport creates or updates an SBOM report (upsert). The caller (internal/api/sbom.go) is expected to have already written the SBOM bytes into the blob store and set report.BlobSHA256/BlobSizeBytes; this upserts the corresponding blobs row and stores the resulting blob_id alongside the report metadata. A zero-value BlobSHA256 stores a NULL blob_id.
func (*PostgresDB) CreateSBTArtifact ¶
func (p *PostgresDB) CreateSBTArtifact(ctx context.Context, artifact *models.SBTArtifact) error
CreateSBTArtifact stores an SBT artifact; a live artifact with the same coordinates is repointed at the new blob.
func (*PostgresDB) CreateSSOProvider ¶
func (p *PostgresDB) CreateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
func (*PostgresDB) CreateSecretScanResult ¶
func (p *PostgresDB) CreateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
CreateSecretScanResult creates a new secret scan result (UPSERT).
func (*PostgresDB) CreateSession ¶
func (*PostgresDB) CreateStorageBackend ¶
func (p *PostgresDB) CreateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
CreateStorageBackend creates a new storage backend configuration.
func (*PostgresDB) CreateStoragePolicy ¶ added in v0.7.0
func (p *PostgresDB) CreateStoragePolicy(ctx context.Context, pol *models.StoragePolicy) error
CreateStoragePolicy inserts a policy (pol.ID must be set).
func (*PostgresDB) CreateStorageTier ¶ added in v0.7.0
func (p *PostgresDB) CreateStorageTier(ctx context.Context, t *models.StorageTier) error
CreateStorageTier inserts a tier (t.ID must be set).
func (*PostgresDB) CreateToken ¶
func (*PostgresDB) CreateUser ¶
func (*PostgresDB) CreateVulnScanResult ¶
func (p *PostgresDB) CreateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
CreateVulnScanResult creates or updates a vulnerability scan result.
func (*PostgresDB) CreateWebhook ¶
CreateWebhook creates a new webhook.
func (*PostgresDB) CreateWebhookDelivery ¶
func (p *PostgresDB) CreateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
CreateWebhookDelivery creates a new webhook delivery record.
func (*PostgresDB) DecrementStorageUsage ¶
func (p *PostgresDB) DecrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
DecrementStorageUsage gives a reservation back (or accounts for a delete), on the repository and on its project's ceiling when that has one. A repository without a quota row has nothing to decrement.
func (*PostgresDB) DeleteAIAnalysis ¶
func (p *PostgresDB) DeleteAIAnalysis(ctx context.Context, repoID, artifactID string) error
DeleteAIAnalysis removes an AI analysis record.
func (*PostgresDB) DeleteArtifactProperty ¶
func (p *PostgresDB) DeleteArtifactProperty(ctx context.Context, repoID, artifactID, key string) error
DeleteArtifactProperty deletes an artifact property.
func (*PostgresDB) DeleteBlobDeletion ¶ added in v0.7.0
func (p *PostgresDB) DeleteBlobDeletion(ctx context.Context, sha256, scope string) error
DeleteBlobDeletion removes a queued deletion (its bytes are gone, or it no longer applies).
func (*PostgresDB) DeleteBlobIfUnreferenced ¶ added in v0.2.0
DeleteBlobIfUnreferenced atomically removes the blobs row for sha256 and queues its bytes for deletion (BlobDeletionScopeAll), but only when no package row still references it. The check, row delete and enqueue run in one transaction under the blob advisory lock; the bytes are removed later by the sweeper, once the grace period has passed and no running backup can still need them. Returns true when the blob was removed.
func (*PostgresDB) DeleteCargoCrate ¶
func (p *PostgresDB) DeleteCargoCrate(ctx context.Context, id string) error
func (*PostgresDB) DeleteCleanupPolicy ¶
func (p *PostgresDB) DeleteCleanupPolicy(ctx context.Context, id string) error
DeleteCleanupPolicy deletes a cleanup policy.
func (*PostgresDB) DeleteComponent ¶
func (p *PostgresDB) DeleteComponent(ctx context.Context, componentID string) error
func (*PostgresDB) DeleteConanPackage ¶
func (p *PostgresDB) DeleteConanPackage(ctx context.Context, id string) error
func (*PostgresDB) DeleteCondaPackage ¶
func (p *PostgresDB) DeleteCondaPackage(ctx context.Context, id string) error
func (*PostgresDB) DeleteDockerBlob ¶
func (p *PostgresDB) DeleteDockerBlob(ctx context.Context, repoID, digest string) error
DeleteDockerBlob removes the repository's row for the blob and returns ErrDockerRowNotFound when there was none.
func (*PostgresDB) DeleteDockerBlobsForGC ¶ added in v0.4.0
func (p *PostgresDB) DeleteDockerBlobsForGC(ctx context.Context, repoID string, digests []string, grace time.Duration) ([]*models.DockerGCBlob, error)
func (*PostgresDB) DeleteDockerManifest ¶
func (p *PostgresDB) DeleteDockerManifest(ctx context.Context, repoID, image, digest string) error
DeleteDockerManifest permanently removes the live manifest row and returns ErrDockerRowNotFound when there was none.
func (*PostgresDB) DeleteDockerManifestsForGC ¶ added in v0.4.0
func (p *PostgresDB) DeleteDockerManifestsForGC(ctx context.Context, repoID string, ids []string, grace time.Duration) ([]*models.DockerGCManifest, error)
func (*PostgresDB) DeleteDockerTag ¶
func (p *PostgresDB) DeleteDockerTag(ctx context.Context, repoID, image, name string) error
func (*PostgresDB) DeleteDockerTagsByDigest ¶ added in v0.4.0
func (p *PostgresDB) DeleteDockerTagsByDigest(ctx context.Context, repoID, image, digest string) error
func (*PostgresDB) DeleteDockerUpload ¶
func (p *PostgresDB) DeleteDockerUpload(ctx context.Context, repositoryID, uploadUUID string) error
func (*PostgresDB) DeleteExpiredProxyCacheEntries ¶
func (p *PostgresDB) DeleteExpiredProxyCacheEntries(ctx context.Context) (int64, error)
func (*PostgresDB) DeleteGoModule ¶
func (p *PostgresDB) DeleteGoModule(ctx context.Context, repoID, modulePath, version string) error
DeleteGoModule deletes a Go module.
func (*PostgresDB) DeleteGroup ¶
func (p *PostgresDB) DeleteGroup(ctx context.Context, id string) error
func (*PostgresDB) DeleteHelmChart ¶
func (p *PostgresDB) DeleteHelmChart(ctx context.Context, repoID, name, version string) error
func (*PostgresDB) DeleteIvyArtifact ¶
func (p *PostgresDB) DeleteIvyArtifact(ctx context.Context, id string) error
func (*PostgresDB) DeleteLicensePolicy ¶
func (p *PostgresDB) DeleteLicensePolicy(ctx context.Context, id string) error
DeleteLicensePolicy deletes a license policy by ID.
func (*PostgresDB) DeleteMavenArtifact ¶
func (p *PostgresDB) DeleteMavenArtifact(ctx context.Context, id string) error
func (*PostgresDB) DeleteNPMDistTag ¶
func (p *PostgresDB) DeleteNPMDistTag(ctx context.Context, packageID, tag string) error
func (*PostgresDB) DeleteNPMPackage ¶
func (p *PostgresDB) DeleteNPMPackage(ctx context.Context, packageID string) error
func (*PostgresDB) DeleteNPMVersion ¶
func (p *PostgresDB) DeleteNPMVersion(ctx context.Context, packageID, version string) error
func (*PostgresDB) DeleteNuGetPackage ¶
func (p *PostgresDB) DeleteNuGetPackage(ctx context.Context, repoID, packageID, version string) error
func (*PostgresDB) DeleteOtherSessionsByUser ¶ added in v0.2.0
func (p *PostgresDB) DeleteOtherSessionsByUser(ctx context.Context, userID, keepTokenHash string) error
DeleteOtherSessionsByUser revokes every session of a user except the one identified by keepTokenHash.
func (*PostgresDB) DeletePackageDelta ¶
func (p *PostgresDB) DeletePackageDelta(ctx context.Context, id string) error
func (*PostgresDB) DeletePermissionAssignment ¶
func (p *PostgresDB) DeletePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
func (*PostgresDB) DeletePermissionTarget ¶
func (p *PostgresDB) DeletePermissionTarget(ctx context.Context, id string) error
func (*PostgresDB) DeletePresignedUpload ¶ added in v0.5.0
func (p *PostgresDB) DeletePresignedUpload(ctx context.Context, id string) error
DeletePresignedUpload removes a presigned upload row.
func (*PostgresDB) DeleteProject ¶ added in v0.6.0
func (p *PostgresDB) DeleteProject(ctx context.Context, id string) error
func (*PostgresDB) DeletePromotionPipeline ¶
func (p *PostgresDB) DeletePromotionPipeline(ctx context.Context, id string) error
func (*PostgresDB) DeleteProxyCacheEntry ¶
func (p *PostgresDB) DeleteProxyCacheEntry(ctx context.Context, repoID, cacheKey string) error
func (*PostgresDB) DeletePyPIPackage ¶
func (p *PostgresDB) DeletePyPIPackage(ctx context.Context, repoID, name, version, filename string) error
func (*PostgresDB) DeleteRawArtifact ¶
func (p *PostgresDB) DeleteRawArtifact(ctx context.Context, repoID, path string) error
DeleteRawArtifact deletes a raw artifact by repo ID and path.
func (*PostgresDB) DeleteReleaseBundle ¶
func (p *PostgresDB) DeleteReleaseBundle(ctx context.Context, id string) error
func (*PostgresDB) DeleteRepository ¶
func (p *PostgresDB) DeleteRepository(ctx context.Context, id string) error
func (*PostgresDB) DeleteRubyGem ¶
func (p *PostgresDB) DeleteRubyGem(ctx context.Context, id string) error
func (*PostgresDB) DeleteSBOMReport ¶
func (p *PostgresDB) DeleteSBOMReport(ctx context.Context, id string) error
DeleteSBOMReport deletes an SBOM report by ID.
func (*PostgresDB) DeleteSBOMReportInRepo ¶ added in v0.2.0
DeleteSBOMReportInRepo deletes the SBOM report with the given ID scoped to repoID and returns the sha256 of the blob it referenced ("" when it had none). Callers should afterwards remove the blob from storage if it is unreferenced (storage.SafeDeleteBlob). Returns ErrSBOMReportNotFound when nothing matched.
func (*PostgresDB) DeleteSBTArtifact ¶
func (p *PostgresDB) DeleteSBTArtifact(ctx context.Context, id string) error
func (*PostgresDB) DeleteSSOProvider ¶
func (p *PostgresDB) DeleteSSOProvider(ctx context.Context, id string) error
func (*PostgresDB) DeleteSession ¶
func (p *PostgresDB) DeleteSession(ctx context.Context, tokenHash string) error
func (*PostgresDB) DeleteSessionsByUser ¶ added in v0.2.0
func (p *PostgresDB) DeleteSessionsByUser(ctx context.Context, userID string) error
DeleteSessionsByUser revokes every session of a user.
func (*PostgresDB) DeleteStaleDockerUploads ¶ added in v0.5.0
func (p *PostgresDB) DeleteStaleDockerUploads(ctx context.Context, cutoff time.Time) ([]string, error)
DeleteStaleDockerUploads deletes the upload sessions idle since before the cutoff and returns their UUIDs.
func (*PostgresDB) DeleteStorageBackend ¶
func (p *PostgresDB) DeleteStorageBackend(ctx context.Context, id string) error
DeleteStorageBackend deletes a storage backend.
func (*PostgresDB) DeleteStoragePolicy ¶ added in v0.7.0
DeleteStoragePolicy deletes a policy; it reports whether a row was removed.
func (*PostgresDB) DeleteStorageTierIfUnused ¶ added in v0.7.0
DeleteStorageTierIfUnused deletes a non-primary tier unless something still depends on it, atomically: the tier and its backend row are locked FOR UPDATE for the whole check-and-delete, so a concurrent move (whose journal and blobs.storage_backend_id writes take a key-share lock on the backend row) either commits before the check and is seen, or waits until the delete is done. It returns "" when the tier was deleted (or was already gone) and the human-readable reason otherwise.
func (*PostgresDB) DeleteUnreferencedInvalidBlobRow ¶ added in v0.5.0
DeleteUnreferencedInvalidBlobRow deletes the blobs row id (a row with an invalid sha256) from the database only, when nothing references it any more. It never touches the storage object: for the shared "" row that object is a real module's zip, now relinked under its true digest. Returns true when the row was deleted.
func (*PostgresDB) DeleteVEXStatement ¶ added in v0.7.0
func (p *PostgresDB) DeleteVEXStatement(ctx context.Context, repoID, id string) error
DeleteVEXStatement deletes a decision scoped to repoID; ErrVEXStatementNotFound when absent.
func (*PostgresDB) DeleteVulnScanResult ¶ added in v0.2.0
func (p *PostgresDB) DeleteVulnScanResult(ctx context.Context, repoID, id string) error
DeleteVulnScanResult deletes a vuln scan result (and its owning scan job) by ID, scoped to repoID. Returns ErrVulnScanNotFound when nothing matched.
func (*PostgresDB) DeleteWebhook ¶
func (p *PostgresDB) DeleteWebhook(ctx context.Context, id string) error
DeleteWebhook deletes a webhook.
func (*PostgresDB) DockerBlobVisible ¶ added in v0.5.0
func (*PostgresDB) EmptySHA256BlobID ¶ added in v0.5.0
func (p *PostgresDB) EmptySHA256BlobID(ctx context.Context) (string, error)
EmptySHA256BlobID returns the id of the shared blobs row with an empty sha256 left behind by OpenArtifact <= 0.4.1, or "" when it does not exist (blobs.sha256 is unique and indexed, so this is a point lookup).
func (*PostgresDB) EnqueueBlobDeletion ¶ added in v0.7.0
func (p *PostgresDB) EnqueueBlobDeletion(ctx context.Context, sha256, scope string) error
EnqueueBlobDeletion queues the copies of sha256 named by scope for deletion (see BlobDeletionScope*). The caller holds the per-blob lock and has already removed what made the copies live (the blobs row, or the placement on that tier); the bytes stay until the grace period has passed and no live backup can still need them.
func (*PostgresDB) EnsureBlob ¶
func (p *PostgresDB) EnsureBlob(ctx context.Context, sha256, mediaType string, size int64) (string, error)
EnsureBlob ensures the global blobs table has a row for sha256 (creating it if it does not exist yet) and returns its blobs.id. Manifests are stored directly in the blob store without a per-repo registry row (unlike docker_blobs), so this is the manifest handlers' entry point into upsertBlobWithMediaType.
func (*PostgresDB) ExistingPresignedUploadIDs ¶ added in v0.5.0
func (p *PostgresDB) ExistingPresignedUploadIDs(ctx context.Context, ids []string) ([]string, error)
ExistingPresignedUploadIDs returns the subset of ids that have a row. Ids that are not UUIDs cannot have one and are dropped.
func (*PostgresDB) FailStorageTierMove ¶ added in v0.7.0
func (p *PostgresDB) FailStorageTierMove(ctx context.Context, sha256, message string) error
FailStorageTierMove records a failed attempt on the journal row.
func (*PostgresDB) FinishStorageTierMove ¶ added in v0.7.0
func (p *PostgresDB) FinishStorageTierMove(ctx context.Context, sha256 string) error
FinishStorageTierMove removes the journal row once the move is complete.
func (*PostgresDB) FlipBlobPlacement ¶ added in v0.7.0
func (p *PostgresDB) FlipBlobPlacement(ctx context.Context, sha256, from, to string, verify func(ctx context.Context) error) (models.FlipOutcome, error)
FlipBlobPlacement atomically repoints blobs.storage_backend_id from `from` to `to` and marks the journal row flipped, in ONE transaction under the per-blob advisory lock that SafeDeleteBlob and uploaders take (WithBlobLock). It is the only place a placement changes: either the whole flip commits or nothing did, so a crash leaves exactly one authoritative placement.
verify runs once the blob lock is held and before the placement changes; a non-nil error aborts the flip. The mover uses it to prove the target copy still exists: every path that removes a copy (uploaders settling a race, SafeDeleteBlob) does so under the same lock, so a copy confirmed here cannot vanish before the flip commits.
func (*PostgresDB) GetAIAnalysis ¶
func (p *PostgresDB) GetAIAnalysis(ctx context.Context, repoID, artifactID string) (*models.AIAnalysis, error)
GetAIAnalysis retrieves an AI analysis by repo and artifact ID.
func (*PostgresDB) GetArtifactProperty ¶
func (p *PostgresDB) GetArtifactProperty(ctx context.Context, repoID, artifactID, key string) (string, error)
GetArtifactProperty gets a single artifact property.
func (*PostgresDB) GetBackupJob ¶
GetBackupJob retrieves a backup job by ID.
func (*PostgresDB) GetBlobPlacement ¶ added in v0.7.0
func (p *PostgresDB) GetBlobPlacement(ctx context.Context, sha256 string) (string, int64, bool, error)
GetBlobPlacement returns where the blob lives ("" = primary store) and its size. found is false when there is no blobs row.
func (*PostgresDB) GetBundleItem ¶
func (p *PostgresDB) GetBundleItem(ctx context.Context, bundleID, sha256 string) (*models.ReleaseBundleItem, error)
func (*PostgresDB) GetCargoCrate ¶
func (p *PostgresDB) GetCargoCrate(ctx context.Context, repoID, name, version string) (*models.CargoCrate, error)
func (*PostgresDB) GetCleanupPolicy ¶
func (p *PostgresDB) GetCleanupPolicy(ctx context.Context, id string) (*models.CleanupPolicy, error)
GetCleanupPolicy retrieves a cleanup policy by ID.
func (*PostgresDB) GetComponentByFilename ¶
func (*PostgresDB) GetComponentByID ¶
GetComponentByID looks up a package by its primary key, trying rpm_packages then deb_packages (row IDs are shared across the rpm_packages and deb_packages tables).
func (*PostgresDB) GetComponentBySHA256 ¶ added in v0.5.0
func (p *PostgresDB) GetComponentBySHA256(ctx context.Context, repoID, sha256 string) (*models.Component, error)
GetComponentBySHA256 finds a live rpm or deb package in a repository by the sha256 of its blob using a single-row lookup per table.
func (*PostgresDB) GetComponentsByRepo ¶
func (p *PostgresDB) GetComponentsByRepo(ctx context.Context, repoID string) ([]models.Component, error)
GetComponentsByRepo lists RPM packages for a repository.
func (*PostgresDB) GetConanPackage ¶
func (p *PostgresDB) GetConanPackage(ctx context.Context, repoID string, key models.ConanFileKey) (*models.ConanPackage, error)
GetConanPackage returns the live file stored under key, or (nil, nil).
func (*PostgresDB) GetCondaPackageFile ¶ added in v0.5.0
func (p *PostgresDB) GetCondaPackageFile(ctx context.Context, repoID, name, version, buildString, platform, extension string) (*models.CondaPackage, error)
GetCondaPackageFile returns the live package file with this exact name, version, build, platform and extension, or nil.
func (*PostgresDB) GetDB ¶
func (p *PostgresDB) GetDB() *sql.DB
GetDB returns the underlying sql.DB connection.
func (*PostgresDB) GetDebBlobInfo ¶ added in v0.2.0
GetDebBlobInfo resolves a blobs.id UUID to its content sha256 and size ("" / 0 if unknown).
func (*PostgresDB) GetDebPackageByID ¶
func (p *PostgresDB) GetDebPackageByID(ctx context.Context, id string) (*models.DebPackage, error)
GetDebPackageByID fetches a DEB package by its primary key.
func (*PostgresDB) GetDebianArchitecturesByDist ¶
func (p *PostgresDB) GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
func (*PostgresDB) GetDebianComponentsByDist ¶
func (p *PostgresDB) GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
func (*PostgresDB) GetDebianDistribution ¶
func (p *PostgresDB) GetDebianDistribution(ctx context.Context, repoID string, name string) (*models.DebianDistribution, error)
func (*PostgresDB) GetDebianDistributionsByRepo ¶
func (p *PostgresDB) GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
func (*PostgresDB) GetDebianPackageByFilename ¶
func (*PostgresDB) GetDebianPackagesByDistComp ¶
func (*PostgresDB) GetDockerBlob ¶
func (p *PostgresDB) GetDockerBlob(ctx context.Context, repoID, digest string) (*models.DockerBlob, error)
func (*PostgresDB) GetDockerManifest ¶
func (p *PostgresDB) GetDockerManifest(ctx context.Context, repoID, image, digest string) (*models.DockerManifest, error)
func (*PostgresDB) GetDockerTag ¶
func (*PostgresDB) GetDockerUpload ¶
func (p *PostgresDB) GetDockerUpload(ctx context.Context, repositoryID, uploadUUID string) (*models.DockerUpload, error)
func (*PostgresDB) GetGoModule ¶
func (p *PostgresDB) GetGoModule(ctx context.Context, repoID, modulePath, version string) (*models.GoModule, error)
GetGoModule retrieves a Go module by repo, path, and version.
func (*PostgresDB) GetGroupByID ¶
func (*PostgresDB) GetGroupByName ¶
func (*PostgresDB) GetHelmChart ¶
func (*PostgresDB) GetIvyArtifact ¶
func (p *PostgresDB) GetIvyArtifact(ctx context.Context, repoID, organisation, module, revision, artifactName, artifactExt string) (*models.IvyArtifact, error)
func (*PostgresDB) GetLatestSnapshot ¶
func (p *PostgresDB) GetLatestSnapshot(ctx context.Context, repoID, groupID, artifactID, version string) (*models.MavenArtifact, error)
func (*PostgresDB) GetLatestSnapshotFile ¶ added in v0.5.0
func (p *PostgresDB) GetLatestSnapshotFile(ctx context.Context, repoID, groupID, artifactID, version, classifier, extension string) (*models.MavenArtifact, error)
func (*PostgresDB) GetLicensePolicy ¶
func (p *PostgresDB) GetLicensePolicy(ctx context.Context, id string) (*models.LicensePolicy, error)
GetLicensePolicy gets a license policy by ID.
func (*PostgresDB) GetLicenseScanResult ¶
func (p *PostgresDB) GetLicenseScanResult(ctx context.Context, repoID, artifactID string) (*models.LicenseScanResult, error)
GetLicenseScanResult gets a license scan result by repo and artifact ID.
func (*PostgresDB) GetLicenseScanResultByID ¶ added in v0.2.0
func (p *PostgresDB) GetLicenseScanResultByID(ctx context.Context, repoID, id string) (*models.LicenseScanResult, error)
GetLicenseScanResultByID returns the license scan result with the given ID scoped to repoID, or nil.
func (*PostgresDB) GetMavenArtifactByPath ¶
func (p *PostgresDB) GetMavenArtifactByPath(ctx context.Context, repoID, path string) (*models.MavenArtifact, error)
func (*PostgresDB) GetMavenArtifactsByGA ¶
func (p *PostgresDB) GetMavenArtifactsByGA(ctx context.Context, repoID, groupID, artifactID string) ([]*models.MavenArtifact, error)
func (*PostgresDB) GetMavenArtifactsByGAV ¶
func (p *PostgresDB) GetMavenArtifactsByGAV(ctx context.Context, repoID, groupID, artifactID, version string) ([]*models.MavenArtifact, error)
func (*PostgresDB) GetNPMDistTags ¶
func (*PostgresDB) GetNPMPackageByName ¶
func (p *PostgresDB) GetNPMPackageByName(ctx context.Context, repoID, fullName string) (*models.NPMPackage, error)
func (*PostgresDB) GetNPMVersion ¶
func (p *PostgresDB) GetNPMVersion(ctx context.Context, packageID, version string) (*models.NPMVersion, error)
func (*PostgresDB) GetNPMVersionStates ¶ added in v0.6.0
func (p *PostgresDB) GetNPMVersionStates(ctx context.Context, packageID string) ([]models.NPMVersionState, error)
func (*PostgresDB) GetNPMVersionsByPackage ¶
func (p *PostgresDB) GetNPMVersionsByPackage(ctx context.Context, packageID string) ([]*models.NPMVersion, error)
func (*PostgresDB) GetNuGetPackage ¶
func (p *PostgresDB) GetNuGetPackage(ctx context.Context, repoID, packageID, version string) (*models.NuGetPackage, error)
func (*PostgresDB) GetOrCreateDebianArchitecture ¶ added in v0.2.0
func (p *PostgresDB) GetOrCreateDebianArchitecture(ctx context.Context, distID, name string) (*models.DebianArchitecture, error)
GetOrCreateDebianArchitecture returns the architecture, creating it atomically if missing.
func (*PostgresDB) GetOrCreateDebianComponent ¶ added in v0.2.0
func (p *PostgresDB) GetOrCreateDebianComponent(ctx context.Context, distID, name string) (*models.DebianComponent, error)
GetOrCreateDebianComponent returns the component, creating it atomically if missing.
func (*PostgresDB) GetOrCreateDebianDistribution ¶ added in v0.2.0
func (p *PostgresDB) GetOrCreateDebianDistribution(ctx context.Context, repoID, name string) (*models.DebianDistribution, error)
GetOrCreateDebianDistribution returns the distribution, creating it atomically if missing.
func (*PostgresDB) GetOrCreateGroup ¶
func (*PostgresDB) GetOrCreatePermissionAssignment ¶
func (p *PostgresDB) GetOrCreatePermissionAssignment(ctx context.Context, targetID, principalType, principalID string) error
func (*PostgresDB) GetOrCreateStorageQuota ¶
func (p *PostgresDB) GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
GetOrCreateStorageQuota gets or creates a storage quota for a repository.
func (*PostgresDB) GetPackageDelta ¶
func (p *PostgresDB) GetPackageDelta(ctx context.Context, repoID, fromSHA256, toSHA256 string) (*models.PackageDelta, error)
func (*PostgresDB) GetPermissionTargetByID ¶
func (p *PostgresDB) GetPermissionTargetByID(ctx context.Context, id string) (*models.PermissionTarget, error)
func (*PostgresDB) GetPermissionTargetByName ¶
func (p *PostgresDB) GetPermissionTargetByName(ctx context.Context, name string) (*models.PermissionTarget, error)
func (*PostgresDB) GetPermissionTargetsForPrincipal ¶
func (p *PostgresDB) GetPermissionTargetsForPrincipal(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
GetPermissionTargetsForPrincipal returns the permission targets held by a user and its groups, from the auth cache when fresh.
func (*PostgresDB) GetPermissionTargetsForPrincipalUncached ¶ added in v0.4.0
func (p *PostgresDB) GetPermissionTargetsForPrincipalUncached(ctx context.Context, userID string, groupIDs []string) ([]*models.PermissionTarget, error)
func (*PostgresDB) GetPresignedUpload ¶ added in v0.5.0
func (p *PostgresDB) GetPresignedUpload(ctx context.Context, repoID, id string) (*models.PresignedUpload, error)
GetPresignedUpload returns the presigned upload id of repository repoID, or nil, nil when there is none.
func (*PostgresDB) GetProject ¶ added in v0.6.0
func (*PostgresDB) GetProjectByName ¶ added in v0.6.0
func (*PostgresDB) GetProjectGroup ¶ added in v0.6.0
func (p *PostgresDB) GetProjectGroup(ctx context.Context, projectID, groupID string) (*models.ProjectGroup, error)
func (*PostgresDB) GetProjectMember ¶ added in v0.6.0
func (p *PostgresDB) GetProjectMember(ctx context.Context, projectID, userID string) (*models.ProjectMember, error)
func (*PostgresDB) GetProjectQuota ¶ added in v0.6.0
func (p *PostgresDB) GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
GetProjectQuota returns the project's storage ceiling; a project that never had one reads as unlimited (zero limits).
func (*PostgresDB) GetProjectUsage ¶ added in v0.6.0
func (p *PostgresDB) GetProjectUsage(ctx context.Context, projectID string) (*models.ProjectUsage, error)
GetProjectUsage reports a project's usage: the sum of its repositories' counters (always available, whether or not a ceiling is set), the ceiling, and one line per live repository, largest first.
func (*PostgresDB) GetPromotionPipelineByID ¶
func (p *PostgresDB) GetPromotionPipelineByID(ctx context.Context, id string) (*models.PromotionPipeline, error)
func (*PostgresDB) GetPromotionPipelineByName ¶
func (p *PostgresDB) GetPromotionPipelineByName(ctx context.Context, name string) (*models.PromotionPipeline, error)
func (*PostgresDB) GetProxyCacheEntry ¶
func (p *PostgresDB) GetProxyCacheEntry(ctx context.Context, repoID, cacheKey string) (*models.ProxyCacheEntry, error)
func (*PostgresDB) GetPyPIPackage ¶
func (p *PostgresDB) GetPyPIPackage(ctx context.Context, repoID, name, version, filename string) (*models.PyPIPackage, error)
func (*PostgresDB) GetPyPIPackageByFilename ¶ added in v0.5.0
func (p *PostgresDB) GetPyPIPackageByFilename(ctx context.Context, repoID, filename string) (*models.PyPIPackage, error)
func (*PostgresDB) GetRPMRepo ¶
func (*PostgresDB) GetRawArtifact ¶
func (p *PostgresDB) GetRawArtifact(ctx context.Context, repoID, path string) (*models.RawArtifact, error)
GetRawArtifact retrieves a raw artifact by repo ID and path.
func (*PostgresDB) GetReleaseBundle ¶
func (p *PostgresDB) GetReleaseBundle(ctx context.Context, name, version string) (*models.ReleaseBundle, error)
func (*PostgresDB) GetReleaseBundleByID ¶
func (p *PostgresDB) GetReleaseBundleByID(ctx context.Context, id string) (*models.ReleaseBundle, error)
func (*PostgresDB) GetRepoComponentBlob ¶ added in v0.3.0
func (p *PostgresDB) GetRepoComponentBlob(ctx context.Context, repoID, id string) (*models.ComponentBlob, error)
GetRepoComponentBlob resolves a row id of the package listing (ListComponentsByRepo) to its blob, scoped to repoID. It returns nil, nil when no row of any format has that id in the repository, or when id is not a UUID.
func (*PostgresDB) GetRepoMetadataByPath ¶
func (p *PostgresDB) GetRepoMetadataByPath(ctx context.Context, repositoryID string, path string) (*models.RepoMetadata, error)
func (*PostgresDB) GetRepoMetadataByRepo ¶
func (p *PostgresDB) GetRepoMetadataByRepo(ctx context.Context, repositoryID string) ([]models.RepoMetadata, error)
func (*PostgresDB) GetRepositoryByID ¶
func (p *PostgresDB) GetRepositoryByID(ctx context.Context, id string) (*models.Repository, error)
GetRepositoryByID retrieves a repository by its primary key.
func (*PostgresDB) GetRepositoryByName ¶
func (p *PostgresDB) GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
GetRepositoryByName returns the repository with the given name, from the auth cache when fresh.
func (*PostgresDB) GetRepositoryByNameUncached ¶ added in v0.4.0
func (p *PostgresDB) GetRepositoryByNameUncached(ctx context.Context, name string) (*models.Repository, error)
func (*PostgresDB) GetRpmPackageByID ¶
func (p *PostgresDB) GetRpmPackageByID(ctx context.Context, id string) (*models.RpmPackage, error)
GetRpmPackageByID fetches an RPM package by its primary key.
func (*PostgresDB) GetRubyGem ¶
func (*PostgresDB) GetSBOMReport ¶
func (p *PostgresDB) GetSBOMReport(ctx context.Context, repoID, artifactID, format, specVersion string) (*models.SBOMReport, error)
GetSBOMReport retrieves an SBOM report by repo, artifact, format, and spec version. BlobSHA256 is resolved via a LEFT JOIN with blobs and is empty for reports that predate blob_id or were created with no content.
func (*PostgresDB) GetSBOMReportByID ¶ added in v0.2.0
func (p *PostgresDB) GetSBOMReportByID(ctx context.Context, repoID, id string) (*models.SBOMReport, error)
GetSBOMReportByID returns the SBOM report with the given ID scoped to repoID, or nil.
func (*PostgresDB) GetSBTArtifact ¶
func (p *PostgresDB) GetSBTArtifact(ctx context.Context, repoID, groupID, artifactID, version, filename string) (*models.SBTArtifact, error)
func (*PostgresDB) GetSSOProviderByID ¶
func (p *PostgresDB) GetSSOProviderByID(ctx context.Context, id string) (*models.SSOProvider, error)
func (*PostgresDB) GetSSOProviderBySlug ¶
func (p *PostgresDB) GetSSOProviderBySlug(ctx context.Context, slug string) (*models.SSOProvider, error)
func (*PostgresDB) GetSecretScanResult ¶
func (p *PostgresDB) GetSecretScanResult(ctx context.Context, repoID, artifactID string) (*models.SecretScanResult, error)
GetSecretScanResult gets a secret scan result by repo and artifact ID.
func (*PostgresDB) GetSessionByTokenHash ¶
func (*PostgresDB) GetStorageBackend ¶
func (p *PostgresDB) GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
GetStorageBackend gets a storage backend by name.
func (*PostgresDB) GetStoragePolicy ¶ added in v0.7.0
func (p *PostgresDB) GetStoragePolicy(ctx context.Context, id string) (*models.StoragePolicy, error)
GetStoragePolicy returns a policy by id, or nil when there is none.
func (*PostgresDB) GetStorageTierByName ¶ added in v0.7.0
func (p *PostgresDB) GetStorageTierByName(ctx context.Context, name string) (*models.StorageTier, error)
GetStorageTierByName returns the named tier, or nil when there is none.
func (*PostgresDB) GetSystemSetting ¶
GetSystemSetting retrieves a system setting by key.
func (*PostgresDB) GetTokenByHash ¶
GetTokenByHash returns the token with the given hash, from the auth cache when fresh.
func (*PostgresDB) GetTokenByHashUncached ¶ added in v0.4.0
func (*PostgresDB) GetTokenByID ¶
func (*PostgresDB) GetTrashItem ¶ added in v0.5.0
func (p *PostgresDB) GetTrashItem(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
GetTrashItem implements TrashStore.
func (*PostgresDB) GetUserByEmail ¶
func (*PostgresDB) GetUserByExternalID ¶
func (*PostgresDB) GetUserByID ¶
GetUserByID returns the user with the given ID, from the auth cache when fresh.
func (*PostgresDB) GetUserByIDUncached ¶ added in v0.4.0
func (*PostgresDB) GetUserByUsername ¶
func (*PostgresDB) GetVulnScanResult ¶
func (p *PostgresDB) GetVulnScanResult(ctx context.Context, repoID, artifactID string) (*models.VulnScanResult, error)
GetVulnScanResult gets a vulnerability scan result by repo and artifact ID. scan_jobs' UNIQUE(artifact_ref_id, scan_type, scanner) allows more than one scanner (osv/trivy/grype/...) to have scanned the same artifact, so this orders by most-recently-created and takes the first row instead of letting QueryRowContext pick an arbitrary one nondeterministically.
func (*PostgresDB) GetVulnScanResultByID ¶ added in v0.2.0
func (p *PostgresDB) GetVulnScanResultByID(ctx context.Context, repoID, id string) (*models.VulnScanResult, error)
GetVulnScanResultByID returns the vuln scan result with the given ID scoped to repoID, or nil.
func (*PostgresDB) GetWebhook ¶
GetWebhook retrieves a webhook by ID.
func (*PostgresDB) HelmIndexStamp ¶ added in v0.6.0
func (*PostgresDB) IncrementCargoDownloadCount ¶
func (p *PostgresDB) IncrementCargoDownloadCount(ctx context.Context, repoID, name, version string) error
func (*PostgresDB) IncrementNuGetDownloadCount ¶
func (p *PostgresDB) IncrementNuGetDownloadCount(ctx context.Context, repoID, packageID, version string) error
func (*PostgresDB) IncrementStorageUsage ¶
func (p *PostgresDB) IncrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
IncrementStorageUsage increments the storage usage for a repository.
func (*PostgresDB) InsertAuditLog ¶
func (*PostgresDB) InsertRawArtifactIfAbsent ¶ added in v0.5.0
func (p *PostgresDB) InsertRawArtifactIfAbsent(ctx context.Context, artifact *models.RawArtifact) (bool, error)
InsertRawArtifactIfAbsent inserts a raw artifact only when no live row exists at its path, in one atomic statement. It reports whether the row was inserted; false means the path is taken and nothing was changed.
func (*PostgresDB) IsArtifactQuarantined ¶ added in v0.2.0
func (p *PostgresDB) IsArtifactQuarantined(ctx context.Context, repoID string, keys []string) (bool, error)
IsArtifactQuarantined reports whether any of keys (artifact_refs.artifact_path values) identifies an artifact of the repository whose vulnerability, secret or license scan result is flagged quarantined.
func (*PostgresDB) LinkDockerBlob ¶ added in v0.5.0
func (p *PostgresDB) LinkDockerBlob(ctx context.Context, repoID, image, digest string) error
func (*PostgresDB) ListAIAnalyses ¶
func (p *PostgresDB) ListAIAnalyses(ctx context.Context, repoID string, status string, licenseReviewOnly bool, limit, offset int) ([]*models.AIAnalysis, int, error)
ListAIAnalyses lists AI analyses for a repository with optional status and REVIEW_REQUIRED license filters.
func (*PostgresDB) ListAllCondaPackages ¶
func (p *PostgresDB) ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
ListAllCondaPackages lists all conda packages for a repository across every platform. Used only by backup export, where ListCondaPackages' mandatory platform filter would silently drop everything else.
func (*PostgresDB) ListAllNPMPackages ¶
func (p *PostgresDB) ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
ListAllNPMPackages lists every npm package for a repository. Used only by backup export.
func (*PostgresDB) ListAllProjects ¶ added in v0.6.0
func (*PostgresDB) ListAllSSOProviders ¶
func (p *PostgresDB) ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
func (*PostgresDB) ListAllTokens ¶
func (*PostgresDB) ListArtifactProperties ¶
func (p *PostgresDB) ListArtifactProperties(ctx context.Context, repoID, artifactID string) (map[string]string, error)
ListArtifactProperties lists all properties for an artifact.
func (*PostgresDB) ListAuditLogs ¶
func (p *PostgresDB) ListAuditLogs(ctx context.Context, params models.AuditListParams) (*models.AuditPage, error)
ListAuditLogs returns one page of audit entries, newest first. It reads Limit+1 rows to learn whether more follow, so no COUNT(*) runs for keyset (After) paging, and offset paging only counts when the page itself cannot answer (see auditTotal).
func (*PostgresDB) ListBackupJobs ¶
ListBackupJobs lists backup jobs with a limit.
func (*PostgresDB) ListBlobRefs ¶ added in v0.7.0
func (p *PostgresDB) ListBlobRefs(ctx context.Context, shas []string) (map[string][]models.BlobRef, error)
ListBlobRefs returns, per blob, the repository entries referencing it (repository name, format and artifact path).
func (*PostgresDB) ListBundleItems ¶
func (p *PostgresDB) ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
func (*PostgresDB) ListBundlePromotions ¶
func (p *PostgresDB) ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
func (*PostgresDB) ListCargoCrateVersions ¶
func (p *PostgresDB) ListCargoCrateVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
func (*PostgresDB) ListCargoIndexVersions ¶ added in v0.6.0
func (p *PostgresDB) ListCargoIndexVersions(ctx context.Context, repoID, name string) ([]*models.CargoCrate, error)
func (*PostgresDB) ListCleanupPolicies ¶
func (p *PostgresDB) ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
ListCleanupPolicies lists all cleanup policies for a repository.
func (*PostgresDB) ListComponentsByRepo ¶
func (p *PostgresDB) ListComponentsByRepo(ctx context.Context, repoID, formatFilter string, page, limit int) ([]*models.Component, int, error)
ListComponentsByRepo lists the packages of one repository across every format (see ListRepoComponents in queries/components.sql for the per-format mapping). formatFilter, when non-empty, restricts the result to one format.
func (*PostgresDB) ListConanPackages ¶
func (p *PostgresDB) ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
func (*PostgresDB) ListConanRecipeFiles ¶ added in v0.5.0
func (p *PostgresDB) ListConanRecipeFiles(ctx context.Context, repoID, name, version, userChannel string) ([]*models.ConanPackage, error)
ListConanRecipeFiles returns every live file of one recipe (all its recipe and package revisions), oldest first.
func (*PostgresDB) ListConanRecipes ¶ added in v0.5.0
func (p *PostgresDB) ListConanRecipes(ctx context.Context, repoID string) ([]models.ConanRecipe, error)
ListConanRecipes returns the distinct recipes that have at least one file.
func (*PostgresDB) ListCondaPackages ¶
func (p *PostgresDB) ListCondaPackages(ctx context.Context, repoID, platform string) ([]*models.CondaPackage, error)
func (*PostgresDB) ListDebPackageEntries ¶ added in v0.2.0
func (p *PostgresDB) ListDebPackageEntries(ctx context.Context, repoID, dist, comp, arch string) ([]models.DebPackageEntry, error)
ListDebPackageEntries returns package entries for a repository in a single query. Empty dist/comp/arch act as wildcards.
func (*PostgresDB) ListDebPackagesByRepo ¶
func (p *PostgresDB) ListDebPackagesByRepo(ctx context.Context, repoID string) ([]*models.DebPackage, error)
ListDebPackagesByRepo lists all DEB packages in a repository.
func (*PostgresDB) ListDockerBlobs ¶
func (p *PostgresDB) ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
func (*PostgresDB) ListDockerGCBlobs ¶ added in v0.4.0
func (*PostgresDB) ListDockerGCManifests ¶ added in v0.4.0
func (p *PostgresDB) ListDockerGCManifests(ctx context.Context, repoID string, grace time.Duration) ([]*models.DockerGCManifest, error)
func (*PostgresDB) ListDockerManifestsByRepo ¶
func (p *PostgresDB) ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
ListDockerManifestsByRepo lists every manifest for a repository, with its blob's sha256 resolved via a JOIN (unlike BlobID above, which is the raw, restore-incompatible blobs.id UUID). Used only by backup export.
func (*PostgresDB) ListDockerManifestsBySubject ¶
func (p *PostgresDB) ListDockerManifestsBySubject(ctx context.Context, repoID, image, subjectDigest string) ([]*models.DockerManifest, error)
ListDockerManifestsBySubject returns manifests in repoID whose OCI `subject` field points at subjectDigest, for the Referrers API (GET /v2/<name>/referrers/<digest>). No sqlc query exists for this lookup, so it runs directly against p.db.
func (*PostgresDB) ListDockerTags ¶
func (*PostgresDB) ListDockerTagsByRepo ¶ added in v0.4.0
func (p *PostgresDB) ListDockerTagsByRepo(ctx context.Context, repoID string, limit int) ([]*models.DockerTag, error)
ListDockerTagsByRepo lists tags across every image of a repository, for backup export.
func (*PostgresDB) ListEnabledCleanupPolicies ¶
func (p *PostgresDB) ListEnabledCleanupPolicies(ctx context.Context) ([]*models.CleanupPolicy, error)
ListEnabledCleanupPolicies lists all enabled cleanup policies.
func (*PostgresDB) ListEnabledSSOProviders ¶
func (p *PostgresDB) ListEnabledSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
func (*PostgresDB) ListExpiredPresignedUploads ¶ added in v0.5.0
ListExpiredPresignedUploads returns up to limit ids of presigned uploads past their complete deadline.
func (*PostgresDB) ListExpiredTrash ¶ added in v0.5.0
ListExpiredTrash implements TrashStore.
func (*PostgresDB) ListGlobalLicensePolicies ¶ added in v0.2.0
func (p *PostgresDB) ListGlobalLicensePolicies(ctx context.Context) ([]*models.LicensePolicy, error)
ListGlobalLicensePolicies lists only the global (repository_id IS NULL) license policies.
func (*PostgresDB) ListGoModuleVersions ¶
func (p *PostgresDB) ListGoModuleVersions(ctx context.Context, repoID, modulePath string) ([]*models.GoModule, error)
ListGoModuleVersions lists all versions of a module.
func (*PostgresDB) ListGoModulesByRepo ¶
func (p *PostgresDB) ListGoModulesByRepo(ctx context.Context, repoID string) ([]*models.GoModule, error)
ListGoModulesByRepo lists every module version for a repository. Used only by backup export, where ListGoModuleVersions' mandatory module path filter would silently drop every other module.
func (*PostgresDB) ListGomodAffectedRows ¶ added in v0.5.0
func (p *PostgresDB) ListGomodAffectedRows(ctx context.Context) ([]GomodAffectedRow, error)
ListGomodAffectedRows returns every gomod_modules row whose zip blob row has a sha256 that is not 64 lowercase hex characters.
func (*PostgresDB) ListGomodSiblingZipKeys ¶ added in v0.5.0
func (p *PostgresDB) ListGomodSiblingZipKeys(ctx context.Context) ([]string, error)
ListGomodSiblingZipKeys returns the digests of valid zip blobs of other gomod_modules rows that share module path and version with an affected row (the same release published in another repository after the upgrade).
func (*PostgresDB) ListGroupMemberRepositories ¶ added in v0.6.0
func (p *PostgresDB) ListGroupMemberRepositories(ctx context.Context, groupRepoID string) ([]*models.Repository, error)
func (*PostgresDB) ListGroupMembers ¶
func (p *PostgresDB) ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
func (*PostgresDB) ListGroups ¶
func (*PostgresDB) ListGroupsByUser ¶
ListGroupsByUser returns the groups of a user, from the auth cache when fresh.
func (*PostgresDB) ListGroupsByUserUncached ¶ added in v0.4.0
func (*PostgresDB) ListHelmChartVersions ¶
func (*PostgresDB) ListHelmCharts ¶
func (*PostgresDB) ListIvyArtifacts ¶
func (p *PostgresDB) ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
func (*PostgresDB) ListLicensePolicies ¶
func (p *PostgresDB) ListLicensePolicies(ctx context.Context, repoID string) ([]*models.LicensePolicy, error)
ListLicensePolicies lists all license policies for a repository (including global policies).
func (*PostgresDB) ListLicenseScanResults ¶
func (p *PostgresDB) ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
ListLicenseScanResults lists all license scan results for a repository.
func (*PostgresDB) ListMavenArtifactsByRepo ¶
func (p *PostgresDB) ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
ListMavenArtifactsByRepo lists every maven artifact for a repository, with its blob's sha256/size resolved via a JOIN (unlike BlobID on the other Get* methods here, which is the raw, restore-incompatible blobs.id UUID). Used only by backup export.
func (*PostgresDB) ListNPMVersionsByRepo ¶
func (p *PostgresDB) ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
ListNPMVersionsByRepo lists every npm version for a repository, with its tarball blob's sha256/size resolved via a JOIN (unlike BlobID on the other Get* methods here, which is the raw, restore-incompatible blobs.id UUID). Used only by backup export.
func (*PostgresDB) ListNuGetPackageVersions ¶
func (p *PostgresDB) ListNuGetPackageVersions(ctx context.Context, repoID, packageID string) ([]*models.NuGetPackage, error)
func (*PostgresDB) ListNuGetPackages ¶
func (p *PostgresDB) ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
func (*PostgresDB) ListPackageDeltas ¶
func (p *PostgresDB) ListPackageDeltas(ctx context.Context, repoID, toSHA256 string) ([]*models.PackageDelta, error)
ListPackageDeltas returns the deltas that target toSHA256. A delta whose source package is in the trash is hidden (it would reveal the trashed file's sha256 and name) and reappears when the source is restored; a source that still has a live row (same blob in another row) keeps its deltas visible.
func (*PostgresDB) ListPendingAIAnalyses ¶
func (p *PostgresDB) ListPendingAIAnalyses(ctx context.Context, limit int) ([]*models.AIAnalysis, error)
ListPendingAIAnalyses returns analyses in "pending" status up to limit.
func (*PostgresDB) ListPermissionAssignments ¶ added in v0.6.0
func (p *PostgresDB) ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
ListPermissionAssignments returns every permission assignment (user and group principals alike).
func (*PostgresDB) ListPermissionTargets ¶
func (p *PostgresDB) ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
func (*PostgresDB) ListProjectCleanupPolicies ¶ added in v0.6.0
func (p *PostgresDB) ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
ListProjectCleanupPolicies lists the default cleanup policies of a project.
func (*PostgresDB) ListProjectCleanupRepositories ¶ added in v0.6.0
func (p *PostgresDB) ListProjectCleanupRepositories(ctx context.Context, projectID string) ([]string, error)
ListProjectCleanupRepositories returns the IDs of the live hosted repositories a project default policy applies to: those without an enabled repository-level policy.
func (*PostgresDB) ListProjectGrantsByUser ¶ added in v0.6.0
func (p *PostgresDB) ListProjectGrantsByUser(ctx context.Context, userID string) ([]*models.ProjectGrant, error)
ListProjectGrantsByUser returns the project grants of a user (see models.ProjectGrant), from the auth cache when fresh.
func (*PostgresDB) ListProjectGroups ¶ added in v0.6.0
func (p *PostgresDB) ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
func (*PostgresDB) ListProjectMembers ¶ added in v0.6.0
func (p *PostgresDB) ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
func (*PostgresDB) ListProjectRepositories ¶ added in v0.6.0
func (p *PostgresDB) ListProjectRepositories(ctx context.Context, projectID string, page, limit int) ([]*models.Repository, int, error)
ListProjectRepositories returns one page of the project's live repositories, newest first, and their total number.
func (*PostgresDB) ListProjectTokens ¶ added in v0.6.0
func (p *PostgresDB) ListProjectTokens(ctx context.Context, projectID string, createdBy *string) ([]*models.Token, error)
ListProjectTokens returns the project's tokens that are not revoked, newest first. createdBy limits them to the tokens minted by that user.
func (*PostgresDB) ListProjects ¶ added in v0.6.0
func (*PostgresDB) ListPromotionCandidates ¶ added in v0.7.0
func (p *PostgresDB) ListPromotionCandidates(ctx context.Context, backendIDs []string, after string, limit int) ([]models.BlobFacts, error)
ListPromotionCandidates returns blobs placed on one of backendIDs that were read after they arrived there (last_accessed_at > tier_changed_at), ordered by sha256 after the cursor, skipping blobs with a move in flight.
func (*PostgresDB) ListPromotionPipelines ¶
func (p *PostgresDB) ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
func (*PostgresDB) ListPublicRepositoryNames ¶ added in v0.3.0
func (p *PostgresDB) ListPublicRepositoryNames(ctx context.Context) ([]string, error)
ListPublicRepositoryNames returns the names of all repositories flagged public.
func (*PostgresDB) ListPyPIPackageNames ¶ added in v0.6.0
func (*PostgresDB) ListPyPIPackageVersions ¶
func (p *PostgresDB) ListPyPIPackageVersions(ctx context.Context, repoID, name string) ([]*models.PyPIPackage, error)
func (*PostgresDB) ListPyPIPackages ¶
func (p *PostgresDB) ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
func (*PostgresDB) ListRawArtifacts ¶
func (p *PostgresDB) ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
ListRawArtifacts lists raw artifacts in a repository, optionally filtered by prefix.
func (*PostgresDB) ListRecoverableStorageTierMoves ¶ added in v0.7.0
func (p *PostgresDB) ListRecoverableStorageTierMoves(ctx context.Context, maxAttempts int, retryAfter time.Duration, limit int) ([]*models.StorageTierMove, error)
ListRecoverableStorageTierMoves returns journal rows that still have attempts left, or that last failed more than retryAfter ago.
func (*PostgresDB) ListReleaseBundles ¶
func (p *PostgresDB) ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
func (*PostgresDB) ListRepositories ¶
func (p *PostgresDB) ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
func (*PostgresDB) ListRpmPackagesByRepo ¶
func (p *PostgresDB) ListRpmPackagesByRepo(ctx context.Context, repoID string) ([]*models.RpmPackage, error)
ListRpmPackagesByRepo lists all RPM packages in a repository.
func (*PostgresDB) ListRpmPackagesForMetadata ¶ added in v0.2.0
func (p *PostgresDB) ListRpmPackagesForMetadata(ctx context.Context, repoID string) ([]pkgrpm.Package, error)
ListRpmPackagesForMetadata loads every rpm package of a repo with dependency, file and changelog data plus the header range, for metadata generation.
func (*PostgresDB) ListRubyGemSpecs ¶ added in v0.6.0
func (*PostgresDB) ListRubyGemVersions ¶
func (*PostgresDB) ListRubyGems ¶
func (*PostgresDB) ListSBOMReports ¶
func (p *PostgresDB) ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
ListSBOMReports lists all SBOM reports for a repository.
func (*PostgresDB) ListSBTArtifacts ¶
func (p *PostgresDB) ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
func (*PostgresDB) ListSecretScanResults ¶
func (p *PostgresDB) ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
ListSecretScanResults lists all secret scan results for a repository.
func (*PostgresDB) ListStorageBackends ¶
func (p *PostgresDB) ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
ListStorageBackends lists all storage backends.
func (*PostgresDB) ListStoragePolicies ¶ added in v0.7.0
func (p *PostgresDB) ListStoragePolicies(ctx context.Context) ([]*models.StoragePolicy, error)
ListStoragePolicies lists every policy in evaluation order.
func (*PostgresDB) ListStorageQuotas ¶ added in v0.6.0
func (p *PostgresDB) ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
ListStorageQuotas returns every repository's quota row.
func (*PostgresDB) ListStorageTierMoves ¶ added in v0.7.0
func (p *PostgresDB) ListStorageTierMoves(ctx context.Context, limit int) ([]*models.StorageTierMove, error)
ListStorageTierMoves returns the most recently touched journal rows.
func (*PostgresDB) ListStorageTiers ¶ added in v0.7.0
func (p *PostgresDB) ListStorageTiers(ctx context.Context) ([]*models.StorageTier, error)
ListStorageTiers lists every tier, hottest rank first.
func (*PostgresDB) ListTokensByUser ¶
func (*PostgresDB) ListTrash ¶ added in v0.5.0
func (p *PostgresDB) ListTrash(ctx context.Context, f models.TrashFilter) ([]*models.TrashItem, int, error)
ListTrash implements TrashStore.
func (*PostgresDB) ListUnindexedDockerManifests ¶ added in v0.4.0
func (p *PostgresDB) ListUnindexedDockerManifests(ctx context.Context, repoID string, limit int) ([]*models.DockerGCManifest, error)
func (*PostgresDB) ListUnreferencedBlobs ¶ added in v0.2.0
func (p *PostgresDB) ListUnreferencedBlobs(ctx context.Context, minAge time.Duration, after string, scan, limit int) ([]string, string, error)
ListUnreferencedBlobs scans one window of at most scan blobs rows whose sha256 sorts after the cursor and returns up to limit of them that no package row references and that are older than minAge (so in-flight uploads, which create the blobs row before their referencing row, are never picked). next is the cursor for the following call and is "" once the end of the table was reached, i.e. the scan wraps around.
Bounding the window (instead of evaluating the reference check for every old blob on every call) keeps the cost of a pass independent of table size, and advancing by sha256 means orphans that cannot be removed never block the ones behind them. Used to reclaim storage after repository deletion cascades its package rows.
func (*PostgresDB) ListUserGroupMemberships ¶ added in v0.6.0
ListUserGroupMemberships returns every user-to-group membership, including the ones an SSO login manages.
func (*PostgresDB) ListUsersByGroup ¶
func (*PostgresDB) ListVEXStatements ¶ added in v0.7.0
func (p *PostgresDB) ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
ListVEXStatements lists the decisions of a repository, optionally only those of one artifact (artifactID != "").
func (*PostgresDB) ListVulnScanOverview ¶ added in v0.7.0
func (p *PostgresDB) ListVulnScanOverview(ctx context.Context, params models.VulnScanListParams) (*models.VulnScanOverviewPage, error)
ListVulnScanOverview returns one page of vulnerability scans across all repositories, worst first. See vulnOverviewQuery.
func (*PostgresDB) ListVulnScanResults ¶
func (p *PostgresDB) ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
ListVulnScanResults lists all vulnerability scan results for a repository.
func (*PostgresDB) ListWebhookDeliveries ¶
func (p *PostgresDB) ListWebhookDeliveries(ctx context.Context, webhookID string, limit int) ([]*models.WebhookDelivery, error)
ListWebhookDeliveries lists deliveries for a webhook.
func (*PostgresDB) ListWebhooks ¶
ListWebhooks lists all webhooks for a repository (or global if repoID is empty).
func (*PostgresDB) ListWebhooksForEvent ¶
func (p *PostgresDB) ListWebhooksForEvent(ctx context.Context, repoID, eventType string) ([]*models.Webhook, error)
ListWebhooksForEvent lists all enabled webhooks that are subscribed to an event.
func (*PostgresDB) MarkPackumentStale ¶
func (p *PostgresDB) MarkPackumentStale(ctx context.Context, packageID string) error
func (*PostgresDB) MarkPresignedUploadCompleted ¶ added in v0.5.0
func (p *PostgresDB) MarkPresignedUploadCompleted(ctx context.Context, id, artifactID string) error
MarkPresignedUploadCompleted records that the upload produced artifactID.
func (*PostgresDB) MarkRepoStale ¶
func (p *PostgresDB) MarkRepoStale(ctx context.Context, repositoryID string) error
MarkRepoStale marks repository metadata as stale for regeneration. NOTE: Currently only tracks staleness for RPM repos via rpm_repos table. DEB staleness tracking needs a separate mechanism (e.g., a stale flag on repositories table).
func (*PostgresDB) Migrate ¶
func (p *PostgresDB) Migrate(ctx context.Context) error
Migrate runs database migrations.
func (*PostgresDB) MoveRepositoryToProject ¶ added in v0.6.0
func (p *PostgresDB) MoveRepositoryToProject(ctx context.Context, repoID, toProjectID string, maxRepositories int) error
MoveRepositoryToProject reassigns a repository to another project, under the target's repository cap when maxRepositories > 0 (ErrProjectRepoLimit). The repository's storage usage moves between the projects' ceilings in the same transaction and must fit the target's (ErrProjectQuotaExceeded).
func (*PostgresDB) Ping ¶
func (p *PostgresDB) Ping(ctx context.Context) error
Ping checks if the database is accessible.
func (*PostgresDB) PruneMavenMetadata ¶ added in v0.5.0
func (p *PostgresDB) PruneMavenMetadata(ctx context.Context, repositoryID, dir string, keep []string) ([]string, error)
PruneMavenMetadata deletes the generated maven-metadata.xml rows below the directory dir (e.g. "com/example/app/"): the artifact's own maven-metadata.xml and the one of each snapshot version directory, except the paths in keep. The regeneration calls it with the paths it just wrote, so metadata of an artifact (or snapshot version) that has no live file left disappears instead of advertising versions that were deleted or trashed. The blob shas of the deleted rows are returned so the caller can reclaim the objects.
func (*PostgresDB) PruneRepoDeltas ¶ added in v0.6.0
func (p *PostgresDB) PruneRepoDeltas(ctx context.Context, repoID string, maxCount int, maxBytes int64) ([]string, error)
PruneRepoDeltas deletes the oldest package_deltas rows of a repository until at most maxCount rows totalling at most maxBytes remain, and returns the delta blob sha256s of the deleted rows (callers release them through storage.SafeDeleteBlob once the rows are gone).
func (*PostgresDB) PurgeExpiredBackupLeases ¶ added in v0.7.0
func (p *PostgresDB) PurgeExpiredBackupLeases(ctx context.Context) (int64, error)
PurgeExpiredBackupLeases removes the leases of backups that stopped renewing them (crashed). An expired lease already blocks nothing; this only tidies up.
func (*PostgresDB) PurgeTrash ¶ added in v0.5.0
func (p *PostgresDB) PurgeTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashPurgeResult, error)
PurgeTrash implements TrashStore.
func (*PostgresDB) QuarantineArtifact ¶
func (p *PostgresDB) QuarantineArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
QuarantineArtifact updates the quarantine status of an artifact.
func (*PostgresDB) QuarantineVulnArtifact ¶
func (p *PostgresDB) QuarantineVulnArtifact(ctx context.Context, repoID, artifactID string, quarantined bool) error
QuarantineVulnArtifact updates the quarantine status of a vulnerable artifact.
func (*PostgresDB) ReconcileAllStorageUsage ¶ added in v0.4.0
func (p *PostgresDB) ReconcileAllStorageUsage(ctx context.Context) (int64, error)
ReconcileAllStorageUsage reconciles every repository (see ReconcileStorageUsage) and returns how many counters were corrected. Only one run is active at a time across replicas: when another holds the lock this returns 0, nil immediately.
func (*PostgresDB) ReconcileStorageUsage ¶ added in v0.4.0
func (p *PostgresDB) ReconcileStorageUsage(ctx context.Context, repoID string) (*models.StorageQuota, error)
ReconcileStorageUsage recomputes the usage counters of one repository from its package rows and returns the corrected quota (creating the quota row, unlimited, if it did not exist). The counters are maintained incrementally with asynchronous commits, so a crash can leave them off; this is the repair.
The recount is one statement over a single snapshot: an upload that has reserved but not yet inserted its row (or a delete that removed the row but not yet released) is not seen consistently, so the result can be off by those in-flight operations until the next reconcile.
func (*PostgresDB) RegenKeys ¶ added in v0.5.0
func (p *PostgresDB) RegenKeys(ctx context.Context, kind models.TrashKind, id string) (string, string, error)
RegenKeys implements TrashStore.
func (*PostgresDB) ReleasePresignedUpload ¶ added in v0.5.0
func (p *PostgresDB) ReleasePresignedUpload(ctx context.Context, id string) error
ReleasePresignedUpload gives up the lease of an upload that was not completed.
func (*PostgresDB) RelinkGomodZips ¶ added in v0.5.0
func (p *PostgresDB) RelinkGomodZips(ctx context.Context, sha256 string, size int64, rowIDs []string) (int64, error)
RelinkGomodZips upserts the blobs row for the zip with digest sha256 and points the given gomod_modules rows at it, but only rows that still reference badBlobID (so a concurrent change is never overwritten). It runs under the same per-blob advisory lock as uploads and SafeDeleteBlob and returns how many rows were relinked.
func (*PostgresDB) RemoveBundleItem ¶
func (p *PostgresDB) RemoveBundleItem(ctx context.Context, bundleID, sha256 string) error
RemoveBundleItem deletes an item only while the bundle is still a draft. The draft check and the delete are one statement that row-locks the bundle, so a concurrent seal cannot slip between them; a non-draft bundle yields ErrBundleNotDraft. Removing an item that is already gone is a no-op.
func (*PostgresDB) RemoveGroupMember ¶
func (p *PostgresDB) RemoveGroupMember(ctx context.Context, groupRepoID, memberRepoID string) error
func (*PostgresDB) RemoveUserFromGroup ¶
func (p *PostgresDB) RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
func (*PostgresDB) RepairBootstrapAdmin ¶ added in v0.2.0
RepairBootstrapAdmin re-binds the named local admin user to admin-all when no principal at all holds that target, which is the state an interrupted bootstrap leaves behind. It never touches an instance where some principal already holds admin-all.
func (*PostgresDB) ReplaceGroupMembers ¶ added in v0.2.0
func (p *PostgresDB) ReplaceGroupMembers(ctx context.Context, groupRepoID string, memberIDs []string) error
ReplaceGroupMembers atomically replaces the member list of a group repository. An empty memberIDs slice clears the group.
func (*PostgresDB) ReserveStorageUsage ¶ added in v0.2.0
func (p *PostgresDB) ReserveStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) (bool, error)
ReserveStorageUsage atomically adds sizeBytes/artifactCount to the repository quota counters if doing so would not exceed the configured limits (a limit of 0 means unlimited), and, when the repository's project has a ceiling, to the project's counters too: the upload must fit both levels, otherwise nothing is reserved. It returns false, nil when a quota would be exceeded.
func (*PostgresDB) RestoreTrash ¶ added in v0.5.0
func (p *PostgresDB) RestoreTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
RestoreTrash implements TrashStore.
func (*PostgresDB) RevokeProjectToken ¶ added in v0.6.0
func (p *PostgresDB) RevokeProjectToken(ctx context.Context, projectID, tokenID string) (bool, error)
RevokeProjectToken revokes a token of the project and disables its service user in one transaction; the auth cache is dropped so the token stops working at once. It reports false when the project has no such active token.
func (*PostgresDB) RevokeToken ¶
func (p *PostgresDB) RevokeToken(ctx context.Context, tokenID string) error
func (*PostgresDB) RpmPackageExists ¶ added in v0.2.0
func (p *PostgresDB) RpmPackageExists(ctx context.Context, repoID, name, version, release string, epoch int, arch string) (bool, error)
RpmPackageExists reports whether the repository already has a package with the NEVRA.
func (*PostgresDB) RubyGemsSpecsStamp ¶ added in v0.6.0
func (*PostgresDB) ScanTierCandidates ¶ added in v0.7.0
func (p *PostgresDB) ScanTierCandidates(ctx context.Context, after string, window int, clauses []models.TierScanClause) ([]models.BlobFacts, string, int, error)
ScanTierCandidates examines one window of at most `window` blobs rows after the cursor and returns those matching any clause (and not already being moved). next is the cursor for the following call, "" once the end of the table was reached; scanned is how many rows the window covered.
func (*PostgresDB) SealReleaseBundle ¶ added in v0.2.0
func (p *PostgresDB) SealReleaseBundle(ctx context.Context, bundleID, sealedBy string, sealedAt time.Time) (bool, error)
SealReleaseBundle moves a draft bundle to sealed with a conditional UPDATE (WHERE state = 'draft'), so concurrent item adds/seals cannot interleave. It reports whether the bundle was sealed; false means it was no longer a draft (or does not exist). A bundle with no items is never sealed.
func (*PostgresDB) SearchByProperty ¶
func (p *PostgresDB) SearchByProperty(ctx context.Context, repoID, key, value string) ([]string, error)
SearchByProperty searches for artifacts by property key and value.
func (*PostgresDB) SearchCargoCrateSummaries ¶ added in v0.5.0
func (p *PostgresDB) SearchCargoCrateSummaries(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrateSummary, int, error)
func (*PostgresDB) SearchCargoCrates ¶
func (p *PostgresDB) SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
func (*PostgresDB) SearchComponents ¶ added in v0.6.0
func (p *PostgresDB) SearchComponents(ctx context.Context, repoID string, opts ComponentListOptions) ([]*models.Component, int, error)
SearchComponents is ListComponentsByRepo with the extra filters and the ordering of ComponentListOptions.
func (*PostgresDB) SearchNuGetPackages ¶
func (p *PostgresDB) SearchNuGetPackages(ctx context.Context, repoID, query string, skip, take int) ([]*models.NuGetPackage, int, error)
SearchNuGetPackages pages over matching packages: skip/take count packages, the total is the number of matching packages, and every live version of each package on the page is returned (grouped by package id, oldest first).
func (*PostgresDB) SearchRubyGems ¶
func (*PostgresDB) SetArtifactProperties ¶ added in v0.2.0
func (p *PostgresDB) SetArtifactProperties(ctx context.Context, repoID, artifactID string, props map[string]string, replace bool) error
SetArtifactProperties upserts all props for an artifact in a single transaction. When replace is true the artifact's existing properties are deleted first, in the same transaction.
func (*PostgresDB) SetArtifactProperty ¶
func (p *PostgresDB) SetArtifactProperty(ctx context.Context, repoID, artifactID, key, value string) error
SetArtifactProperty sets or updates an artifact property (UPSERT).
func (*PostgresDB) SetBlobDeletionGrace ¶ added in v0.7.0
func (p *PostgresDB) SetBlobDeletionGrace(d time.Duration)
SetBlobDeletionGrace sets how long the bytes of a deleted blob (or of a tier copy a placement flip retired) are kept before the sweeper may remove them. Zero means as soon as no running backup can still need them.
func (*PostgresDB) SetDebControlFields ¶ added in v0.2.0
func (p *PostgresDB) SetDebControlFields(ctx context.Context, packageID, maintainer, homepage string, fields map[string]string) error
SetDebControlFields stores the control stanza, maintainer and homepage of a deb package.
func (*PostgresDB) SetDockerManifestRefs ¶ added in v0.4.0
func (p *PostgresDB) SetDockerManifestRefs(ctx context.Context, repoID string, m *models.DockerGCManifest, refs models.DockerManifestRefs) error
func (*PostgresDB) SetLicenseScanQuarantine ¶ added in v0.4.0
func (p *PostgresDB) SetLicenseScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
SetLicenseScanQuarantine quarantines (true) or approves (false) the artifact of exactly one license scan result (by ID, scoped to repoID). Approving records the decision for the licenses currently stored, so a later scan that finds the same licenses does not quarantine the artifact again; quarantining clears it. Returns ErrLicenseScanNotFound when nothing matched.
func (*PostgresDB) SetNuGetDependencyGroups ¶ added in v0.6.0
func (p *PostgresDB) SetNuGetDependencyGroups(ctx context.Context, repoID, packageID, version string, groups []byte) error
SetNuGetDependencyGroups records the dependency groups of a package that has none stored yet. A stored value is never overwritten and updated_at is not touched.
func (*PostgresDB) SetProjectGroup ¶ added in v0.6.0
func (p *PostgresDB) SetProjectGroup(ctx context.Context, projectID, groupID, role string, createdBy *string) error
SetProjectGroup attaches the group to the project with role, or changes the role of an existing attachment.
func (*PostgresDB) SetProjectQuota ¶ added in v0.6.0
func (p *PostgresDB) SetProjectQuota(ctx context.Context, projectID string, maxSizeBytes, maxArtifactCount int64, warnThresholdPercent int) (*models.ProjectQuota, error)
SetProjectQuota stores the project's storage ceiling (0 = unlimited) and returns it. Enabling a limit initialises the project counters from the repository counters in the same transaction; disabling it zeroes them (they are only maintained while a limit is set).
func (*PostgresDB) SetSystemSetting ¶
func (p *PostgresDB) SetSystemSetting(ctx context.Context, key, value string) error
SetSystemSetting sets or updates a system setting.
func (*PostgresDB) SetTrashRetentionDays ¶ added in v0.5.0
func (p *PostgresDB) SetTrashRetentionDays(days int)
SetTrashRetentionDays sets the server-wide default retention, in days, for repositories whose trash_retention_days is NULL.
func (*PostgresDB) SetVulnScanQuarantine ¶ added in v0.2.0
func (p *PostgresDB) SetVulnScanQuarantine(ctx context.Context, repoID, id string, quarantined bool) error
SetVulnScanQuarantine sets the quarantined flag of exactly one vuln scan result (by ID, scoped to repoID). Returns ErrVulnScanNotFound when nothing matched.
func (*PostgresDB) StorageBackendBusyReason ¶ added in v0.7.0
func (p *PostgresDB) StorageBackendBusyReason(ctx context.Context, backendID string) (string, error)
StorageBackendBusyReason reports why a backend's kind or config must not change (or the backend not be deleted): it holds blobs, is served by a tier or is named by a move journal row. "" means it is idle.
func (*PostgresDB) StorageTierUsage ¶ added in v0.7.0
StorageTierUsage returns blob counts and bytes per placement ("" = primary store).
func (*PostgresDB) SyncSSOGroups ¶
func (*PostgresDB) SyncSSOPermissionsForGroup ¶
func (*PostgresDB) TouchBlobAccess ¶ added in v0.7.0
func (p *PostgresDB) TouchBlobAccess(ctx context.Context, accessed map[string]time.Time, resolution time.Duration) (int64, error)
TouchBlobAccess raises blobs.last_accessed_at for the given blobs in one statement. A blob whose recorded access is already within resolution of the new time is left alone, so repeated downloads of a hot blob cost no write. The exception is a blob whose recorded access is not newer than its last tier change: its first read on the new tier is always written, or promote-on-read would miss it for up to resolution after a demotion.
Rows are locked in sha256 order (FOR UPDATE under ORDER BY) so two replicas flushing overlapping sets cannot deadlock each other. Every write here is a non-HOT update (last_accessed_at is in the promotion index predicate), which the access resolution bounds to one per blob per resolution window.
func (*PostgresDB) TouchDockerBlob ¶ added in v0.4.0
TouchDockerBlob records that a client has just relied on the blob (HEAD probe, re-push, mount), so registry GC keeps it for its grace period. It reports false when the repository no longer has the blob.
func (*PostgresDB) TrashRepository ¶ added in v0.5.0
TrashRepository implements TrashStore.
func (*PostgresDB) TrashRows ¶ added in v0.5.0
func (p *PostgresDB) TrashRows(ctx context.Context, repoID string, kind models.TrashKind, ids []string, deletedBy string) (bool, error)
TrashRows implements TrashStore.
func (*PostgresDB) TrashedRepositoryByName ¶ added in v0.5.0
func (p *PostgresDB) TrashedRepositoryByName(ctx context.Context, name string) (*models.TrashItem, error)
TrashedRepositoryByName returns the repository in the trash that holds name (its name stays reserved until it is purged or restored), ErrTrashNotFound when no trashed repository has it. It is not part of TrashStore: only the repository-create conflict message needs it.
func (*PostgresDB) TryGomodRepairLock ¶ added in v0.5.0
func (p *PostgresDB) TryGomodRepairLock(ctx context.Context) (func(), bool, error)
TryGomodRepairLock takes the repair's session advisory lock on a pinned connection. ok is false when another replica holds it. release must be called when ok is true; it unlocks and returns the connection to the pool.
func (*PostgresDB) UnreferencedBlobKeys ¶ added in v0.5.0
UnreferencedBlobKeys returns the subset of ids (blob store keys) that no blobs row carries as its sha256.
func (*PostgresDB) UpdateBackupJob ¶
UpdateBackupJob updates an existing backup job.
func (*PostgresDB) UpdateBundlePromotion ¶
func (p *PostgresDB) UpdateBundlePromotion(ctx context.Context, pr *models.BundlePromotion) error
func (*PostgresDB) UpdateCleanupPolicy ¶
func (p *PostgresDB) UpdateCleanupPolicy(ctx context.Context, policy *models.CleanupPolicy) error
UpdateCleanupPolicy updates an existing cleanup policy.
func (*PostgresDB) UpdateCleanupPolicyRunResult ¶
func (p *PostgresDB) UpdateCleanupPolicyRunResult(ctx context.Context, id string, deletedCount int, runErr error) error
UpdateCleanupPolicyRunResult updates the run result of a cleanup policy.
func (*PostgresDB) UpdateDockerUploadOffset ¶
func (p *PostgresDB) UpdateDockerUploadOffset(ctx context.Context, repositoryID, uploadUUID string, oldOffset, newOffset int64) (bool, error)
UpdateDockerUploadOffset moves the session's offset from oldOffset to newOffset and reports whether it did: false means the offset no longer equals oldOffset (another request advanced or completed the session).
func (*PostgresDB) UpdateGroup ¶
func (*PostgresDB) UpdateLicensePolicy ¶
func (p *PostgresDB) UpdateLicensePolicy(ctx context.Context, policy *models.LicensePolicy) error
UpdateLicensePolicy updates a license policy.
func (*PostgresDB) UpdateLicenseScanResult ¶
func (p *PostgresDB) UpdateLicenseScanResult(ctx context.Context, result *models.LicenseScanResult) error
UpdateLicenseScanResult updates a license scan result.
func (*PostgresDB) UpdateNPMPackageLatestVersion ¶
func (p *PostgresDB) UpdateNPMPackageLatestVersion(ctx context.Context, packageID, latestVersion string) error
func (*PostgresDB) UpdateNPMVersionManifest ¶ added in v0.5.0
func (*PostgresDB) UpdatePermissionTarget ¶
func (p *PostgresDB) UpdatePermissionTarget(ctx context.Context, target *models.PermissionTarget) error
func (*PostgresDB) UpdateProject ¶ added in v0.6.0
func (*PostgresDB) UpdatePromotionPipeline ¶
func (p *PostgresDB) UpdatePromotionPipeline(ctx context.Context, pp *models.PromotionPipeline) error
func (*PostgresDB) UpdateReleaseBundle ¶
func (p *PostgresDB) UpdateReleaseBundle(ctx context.Context, b *models.ReleaseBundle) error
func (*PostgresDB) UpdateRepository ¶
func (p *PostgresDB) UpdateRepository(ctx context.Context, repo *models.Repository) error
func (*PostgresDB) UpdateRepositoryAndMembers ¶ added in v0.5.0
func (p *PostgresDB) UpdateRepositoryAndMembers(ctx context.Context, repo *models.Repository, memberIDs []string) error
UpdateRepositoryAndMembers updates the repository row and replaces its group members in one transaction, so a failure of either leaves neither applied.
func (*PostgresDB) UpdateRpmPackageExtra ¶ added in v0.4.0
func (p *PostgresDB) UpdateRpmPackageExtra(ctx context.Context, repoID, sha256 string, extra []byte) error
UpdateRpmPackageExtra replaces rpm_extra for the packages of a repo backed by the blob with the given sha256. When the extra data carries sizes (sizes_parsed, see pkgrpm.Package.MarshalExtra) the installed_size and archive_size columns are corrected from it too: rows stored before the header size tags were read properly hold 0.
func (*PostgresDB) UpdateSSOProvider ¶
func (p *PostgresDB) UpdateSSOProvider(ctx context.Context, provider *models.SSOProvider) error
func (*PostgresDB) UpdateSecretScanResult ¶
func (p *PostgresDB) UpdateSecretScanResult(ctx context.Context, result *models.SecretScanResult) error
UpdateSecretScanResult updates a secret scan result.
func (*PostgresDB) UpdateSessionLastSeen ¶
func (*PostgresDB) UpdateStorageBackend ¶
func (p *PostgresDB) UpdateStorageBackend(ctx context.Context, backend *models.StorageBackend) error
UpdateStorageBackend updates a storage backend configuration.
func (*PostgresDB) UpdateStorageBackendStatus ¶
func (p *PostgresDB) UpdateStorageBackendStatus(ctx context.Context, id, status string, message *string) error
UpdateStorageBackendStatus updates the status of a storage backend.
func (*PostgresDB) UpdateStoragePolicy ¶ added in v0.7.0
func (p *PostgresDB) UpdateStoragePolicy(ctx context.Context, pol *models.StoragePolicy) error
UpdateStoragePolicy overwrites every field of the policy.
func (*PostgresDB) UpdateStorageQuota ¶
func (p *PostgresDB) UpdateStorageQuota(ctx context.Context, quota *models.StorageQuota) error
UpdateStorageQuota updates a storage quota.
func (*PostgresDB) UpdateStorageTier ¶ added in v0.7.0
func (p *PostgresDB) UpdateStorageTier(ctx context.Context, t *models.StorageTier) error
UpdateStorageTier updates a tier's name, rank and promote-on-read flag.
func (*PostgresDB) UpdateTokenLastUsed ¶
func (p *PostgresDB) UpdateTokenLastUsed(ctx context.Context, tokenID string) error
func (*PostgresDB) UpdateUser ¶
func (*PostgresDB) UpdateUserLastLogin ¶ added in v0.5.0
func (*PostgresDB) UpdateUserPassword ¶ added in v0.5.0
func (*PostgresDB) UpdateUserSSO ¶
func (*PostgresDB) UpdateUserSSOProfile ¶ added in v0.6.0
func (*PostgresDB) UpdateVulnScanResult ¶
func (p *PostgresDB) UpdateVulnScanResult(ctx context.Context, result *models.VulnScanResult) error
UpdateVulnScanResult updates a vulnerability scan result.
func (*PostgresDB) UpdateWebhook ¶
UpdateWebhook updates an existing webhook.
func (*PostgresDB) UpdateWebhookDelivery ¶
func (p *PostgresDB) UpdateWebhookDelivery(ctx context.Context, delivery *models.WebhookDelivery) error
UpdateWebhookDelivery updates a webhook delivery record.
func (*PostgresDB) UpsertAIAnalysis ¶
func (p *PostgresDB) UpsertAIAnalysis(ctx context.Context, analysis *models.AIAnalysis) error
UpsertAIAnalysis inserts or updates an AI analysis record.
AI analyses are stored across scan_jobs + artifact_refs + ai_results; ArtifactName/ArtifactVersion live on ai_results (artifact_refs only tracks repository_id/artifact_path/format). analysis.Status's "processing" value is mapped onto scan_jobs' CHECK-constrained "running" (see aiStatusToJob/FromJob).
Only a "completed" analysis overwrites the result columns (summary, tags, license, security notes, model, token counts). A "processing", "pending" or "failed" upsert keeps what the last completed run stored, so a re-trigger or a failed re-analysis never wipes a good result; the status and error live on scan_jobs and always follow the latest upsert.
func (*PostgresDB) UpsertBlob ¶
func (p *PostgresDB) UpsertBlob(ctx context.Context, sha256, blobKey string, sizeBytes int64) (string, error)
UpsertBlob inserts a blob row keyed by sha256 and returns its id, using ON CONFLICT to handle concurrent uploads safely.
func (*PostgresDB) UpsertDockerTag ¶
func (*PostgresDB) UpsertNPMDistTag ¶
func (p *PostgresDB) UpsertNPMDistTag(ctx context.Context, t *models.NPMDistTag) (*models.NPMDistTag, error)
func (*PostgresDB) UpsertProxyCacheEntry ¶
func (p *PostgresDB) UpsertProxyCacheEntry(ctx context.Context, entry *models.ProxyCacheEntry) error
func (*PostgresDB) UpsertRawArtifact ¶
func (p *PostgresDB) UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
UpsertRawArtifact inserts or updates a raw artifact.
func (*PostgresDB) UpsertRepoMetadata ¶
func (p *PostgresDB) UpsertRepoMetadata(ctx context.Context, meta *models.RepoMetadata) error
func (*PostgresDB) UpsertVEXStatement ¶ added in v0.7.0
func (p *PostgresDB) UpsertVEXStatement(ctx context.Context, s *models.VEXStatement) error
UpsertVEXStatement records (or replaces) the decision for (RepositoryID, ArtifactID, VulnID) and fills the stored row back into s.
func (*PostgresDB) VulnScanOverviewSummary ¶ added in v0.7.0
func (p *PostgresDB) VulnScanOverviewSummary(ctx context.Context, repoName string) (*models.VulnScanSummary, error)
VulnScanOverviewSummary counts the overview's scans in one pass, all of them or those of one repository.
func (*PostgresDB) WithBlobLock ¶ added in v0.2.0
func (p *PostgresDB) WithBlobLock(ctx context.Context, sha256 string, fn func(ctx context.Context) error) error
WithBlobLock runs fn inside a transaction holding a transaction-scoped advisory lock keyed on the blob sha256. Uploaders that create a reference to a blob and the garbage collector (DeleteBlobIfUnreferenced) serialize on the same lock, so a blob cannot be deleted between "ref count == 0" and the uploader's insert.
func (*PostgresDB) WithBlobLocks ¶ added in v0.2.0
func (p *PostgresDB) WithBlobLocks(ctx context.Context, shas []string, fn func(ctx context.Context) error) error
WithBlobLocks is WithBlobLock for several blobs at once: all locks are taken on ONE transaction connection, in sorted order (so two callers locking overlapping sets cannot deadlock each other), and held until fn returns. Taking them through nested WithBlobLock calls instead would pin one pooled connection per lock and let concurrent callers exhaust the pool.
func (*PostgresDB) YankCargoCrate ¶
func (*PostgresDB) YankRubyGem ¶
type PostgresTx ¶
type PostgresTx struct {
// contains filtered or unexported fields
}
PostgresTx implements the Transaction interface for PostgreSQL.
func (*PostgresTx) ExecContext ¶
func (*PostgresTx) QueryContext ¶
func (t *PostgresTx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryContext executes a query that returns rows.
func (*PostgresTx) QueryRowContext ¶
QueryRowContext executes a query that returns a single row.
func (*PostgresTx) Rollback ¶
func (t *PostgresTx) Rollback() error
Rollback rolls back the transaction.
type ProjectRoleGuard ¶ added in v0.6.0
ProjectRoleGuard decides a member or group change while the project row is locked. current is the target's role before the change ("" when the target has none); a non-nil error vetoes the change and is returned unchanged.
type ProjectTokenSpec ¶ added in v0.6.0
type ProjectTokenSpec struct {
ProjectID string
// ProjectSlug seeds the service user's name.
ProjectSlug string
Name string
// Role is the token's project role (viewer or developer).
Role string
CreatedBy string
TokenHash string
ExpiresAt *time.Time
// MaxActive caps the active (not revoked) tokens of the project.
MaxActive int
}
ProjectTokenSpec describes a project token to mint.
type SnapshotReader ¶ added in v0.7.0
type SnapshotReader interface {
GetComponentsByRepo(ctx context.Context, repoID string) ([]models.Component, error)
GetDebianArchitecturesByDist(ctx context.Context, distID string) ([]models.DebianArchitecture, error)
GetDebianComponentsByDist(ctx context.Context, distID string) ([]models.DebianComponent, error)
GetDebianDistributionsByRepo(ctx context.Context, repoID string) ([]models.DebianDistribution, error)
GetDebianPackagesByDistComp(ctx context.Context, repoID string, dist string, comp string, arch string) ([]models.Component, error)
GetNPMDistTags(ctx context.Context, packageID string) (map[string]string, error)
GetProjectQuota(ctx context.Context, projectID string) (*models.ProjectQuota, error)
ListAIAnalyses(ctx context.Context, repoID string, status string, licenseReviewOnly bool, limit, offset int) ([]*models.AIAnalysis, int, error)
ListAllCondaPackages(ctx context.Context, repoID string) ([]*models.CondaPackage, error)
ListAllNPMPackages(ctx context.Context, repoID string) ([]*models.NPMPackage, error)
ListAllProjects(ctx context.Context) ([]*models.Project, error)
ListAllSSOProviders(ctx context.Context) ([]*models.SSOProvider, error)
ListAllTokens(ctx context.Context, page, perPage int) ([]*models.Token, int, error)
ListBundleItems(ctx context.Context, bundleID string) ([]*models.ReleaseBundleItem, error)
ListBundlePromotions(ctx context.Context, bundleID string) ([]*models.BundlePromotion, error)
ListCleanupPolicies(ctx context.Context, repoID string) ([]*models.CleanupPolicy, error)
ListConanPackages(ctx context.Context, repoID string) ([]*models.ConanPackage, error)
ListDockerBlobs(ctx context.Context, repoID string) ([]*models.DockerBlob, error)
ListDockerManifestsByRepo(ctx context.Context, repoID string) ([]*models.DockerManifest, error)
ListDockerTagsByRepo(ctx context.Context, repoID string, limit int) ([]*models.DockerTag, error)
ListGoModulesByRepo(ctx context.Context, repoID string) ([]*models.GoModule, error)
ListGroupMembers(ctx context.Context, groupRepoID string) ([]*models.RepositoryGroupMember, error)
ListGroups(ctx context.Context) ([]*models.Group, error)
ListHelmCharts(ctx context.Context, repoID string) ([]*models.HelmChart, error)
ListIvyArtifacts(ctx context.Context, repoID string) ([]*models.IvyArtifact, error)
ListLicenseScanResults(ctx context.Context, repoID string) ([]*models.LicenseScanResult, error)
ListMavenArtifactsByRepo(ctx context.Context, repoID string) ([]*models.MavenArtifact, error)
ListNPMVersionsByRepo(ctx context.Context, repoID string) ([]*models.NPMVersion, error)
ListNuGetPackages(ctx context.Context, repoID string) ([]*models.NuGetPackage, error)
ListPermissionAssignments(ctx context.Context) ([]*models.PermissionAssignment, error)
ListPermissionTargets(ctx context.Context) ([]*models.PermissionTarget, error)
ListProjectCleanupPolicies(ctx context.Context, projectID string) ([]*models.CleanupPolicy, error)
ListProjectGroups(ctx context.Context, projectID string) ([]*models.ProjectGroup, error)
ListProjectMembers(ctx context.Context, projectID string) ([]*models.ProjectMember, error)
ListPromotionPipelines(ctx context.Context) ([]*models.PromotionPipeline, error)
ListPyPIPackages(ctx context.Context, repoID string) ([]*models.PyPIPackage, error)
ListRawArtifacts(ctx context.Context, repoID, prefix string) ([]*models.RawArtifact, error)
ListReleaseBundles(ctx context.Context, nameFilter, stateFilter string, page, limit int) ([]*models.ReleaseBundle, int, error)
ListRepositories(ctx context.Context, page, limit int, formatFilter string) ([]*models.Repository, error)
ListRubyGems(ctx context.Context, repoID string) ([]*models.RubyGem, error)
ListSBOMReports(ctx context.Context, repoID string) ([]*models.SBOMReport, error)
ListVEXStatements(ctx context.Context, repoID, artifactID string) ([]*models.VEXStatement, error)
ListSBTArtifacts(ctx context.Context, repoID string) ([]*models.SBTArtifact, error)
ListSecretScanResults(ctx context.Context, repoID string, flaggedOnly bool) ([]*models.SecretScanResult, error)
ListStorageBackends(ctx context.Context) ([]*models.StorageBackend, error)
ListStorageQuotas(ctx context.Context) ([]*models.StorageQuota, error)
ListUserGroupMemberships(ctx context.Context) ([]*models.UserGroup, error)
ListUsers(ctx context.Context, page, perPage int) ([]*models.User, int, error)
ListVulnScanResults(ctx context.Context, repoID string, vulnerableOnly bool) ([]*models.VulnScanResult, error)
ListWebhooks(ctx context.Context, repoID string) ([]*models.Webhook, error) // repoID="" = global
SearchCargoCrates(ctx context.Context, repoID, query string, limit int) ([]*models.CargoCrate, error)
// ListBlobsAfter returns up to limit stored objects with sha256 > after, in
// sha256 order: blobs rows plus the generated metadata and deltas that
// have no blobs row.
ListBlobsAfter(ctx context.Context, after string, limit int) ([]BlobRow, error)
// CountBlobs returns the number of objects ListBlobsAfter pages through.
CountBlobs(ctx context.Context) (int64, error)
// Release ends the snapshot and removes its lease. It is idempotent.
Release()
}
SnapshotReader reads the database as of one instant: every call sees the same committed state, however long the backup takes and whatever is written meanwhile. It is read-only by construction (only read methods are listed, and the underlying transactions are READ ONLY).
A snapshot also holds a lease: while it is open, the sweeper deletes no blob bytes the snapshot can still see (a blob deleted, or a tier copy retired, after the snapshot was taken stays readable). Release ends both; a crashed holder's lease expires on its own.
type Transaction ¶
type Transaction interface {
// Commit commits the transaction
Commit() error
// Rollback rolls back the transaction
Rollback() error
// Exec executes a query without returning rows
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
// Query executes a query that returns rows
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
// QueryRow executes a query that returns a single row
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
Transaction defines the interface for database transactions.
type TrashStore ¶ added in v0.5.0
type TrashStore interface {
// TrashRows soft-deletes the given rows of repoID (stamps deleted_at and
// deleted_by) and returns true. It returns false without touching anything
// when the repository's retention is 0: the caller then hard-deletes as
// before. ErrTrashNotFound means none of the rows is live in repoID.
TrashRows(ctx context.Context, repoID string, kind models.TrashKind, ids []string, deletedBy string) (bool, error)
// TrashRepository soft-deletes a repository (contents stay in place, hidden
// with it). It returns false without touching anything when retention is 0.
TrashRepository(ctx context.Context, id, deletedBy string) (bool, error)
// ListTrash lists trashed items (newest first) and the total count.
ListTrash(ctx context.Context, f models.TrashFilter) ([]*models.TrashItem, int, error)
// GetTrashItem returns one trashed item, ErrTrashNotFound when absent.
GetTrashItem(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
// RestoreTrash brings an item (or a repository) back. ErrTrashNotFound,
// ErrTrashConflict (unique key taken meanwhile) and ErrTrashRepoTrashed
// are the expected failures.
RestoreTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashItem, error)
// PurgeTrash permanently removes a trashed item (or repository, cascading
// its contents) and reports what the caller must clean up: blobs to free via
// storage.SafeDeleteBlob and quota to release. A repository's blobs are not
// listed (they can be numerous); the caller collects orphans afterwards.
// A foreign-key violation (IsForeignKeyViolation) means the repository is
// still referenced, e.g. by a release bundle.
PurgeTrash(ctx context.Context, kind models.TrashKind, id string) (*models.TrashPurgeResult, error)
// RegenKeys returns what the metadata workers key a refresh by for an item:
// (group_id, artifact_id) for a Maven artifact, (package_id, "") for an npm
// version and ("", "") for every other kind (deb/rpm refresh per repository).
RegenKeys(ctx context.Context, kind models.TrashKind, id string) (string, string, error)
// ListExpiredTrash returns up to limit items whose retention window has
// passed (items of repositories that are themselves in the trash are
// left to the repository's own purge).
ListExpiredTrash(ctx context.Context, limit int) ([]models.TrashRef, error)
}
TrashStore is the storage side of soft delete (internal/trash, the trash API and the purge worker). PostgresDB implements it; handlers treat a database that does not (test fakes) as "soft delete unavailable" and hard-delete.
Retention is resolved per repository: repositories.trash_retention_days, or the server default (SetTrashRetentionDays) when NULL. 0 means no trash.
Source Files
¶
- auth_cache.go
- blobhash.go
- docker.go
- docker_gc.go
- gomod_repair.go
- interfaces.go
- migrate.go
- migrate_split.go
- mock_db.go
- postgres.go
- postgres_apibundlesscans.go
- postgres_apirepos.go
- postgres_auth.go
- postgres_authsec.go
- postgres_backup_lists.go
- postgres_blob_deletions.go
- postgres_blobs.go
- postgres_bundles.go
- postgres_conn.go
- postgres_deb.go
- postgres_licensequarantine.go
- postgres_maven.go
- postgres_meta_stamps.go
- postgres_npm.go
- postgres_presigned.go
- postgres_project_quota.go
- postgres_project_tokens.go
- postgres_projects.go
- postgres_quarantine.go
- postgres_quota.go
- postgres_rpm.go
- postgres_scanrows.go
- postgres_snapshot.go
- postgres_sso.go
- postgres_tiering.go
- postgres_tokens.go
- postgres_vex.go
- postgres_vulnoverview.go
- postgres_wait.go
- snapshot.go
- trash.go
- trash_kinds.go