forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiface.go
More file actions
106 lines (84 loc) · 5.51 KB
/
iface.go
File metadata and controls
106 lines (84 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package uploads
import (
"context"
"io"
"time"
"github.com/grafana/regexp"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/authz"
sharedIndexes "github.com/sourcegraph/sourcegraph/internal/codeintel/autoindexing/shared"
policies "github.com/sourcegraph/sourcegraph/internal/codeintel/policies/enterprise"
codeintelgitserver "github.com/sourcegraph/sourcegraph/internal/codeintel/shared/gitserver"
codeinteltypes "github.com/sourcegraph/sourcegraph/internal/codeintel/shared/types"
sharedUploads "github.com/sourcegraph/sourcegraph/internal/codeintel/uploads/shared"
"github.com/sourcegraph/sourcegraph/internal/database/locker"
"github.com/sourcegraph/sourcegraph/internal/gitserver"
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
"github.com/sourcegraph/sourcegraph/internal/gitserver/protocol"
"github.com/sourcegraph/sourcegraph/internal/types"
dbworkerstore "github.com/sourcegraph/sourcegraph/internal/workerutil/dbworker/store"
)
type Locker interface {
Lock(ctx context.Context, key int32, blocking bool) (bool, locker.UnlockFunc, error)
}
type CommitCache interface {
ExistsBatch(ctx context.Context, commits []codeintelgitserver.RepositoryCommit) ([]bool, error)
}
type GitserverClient interface {
CommitGraph(ctx context.Context, repositoryID int, opts gitserver.CommitGraphOptions) (_ *gitdomain.CommitGraph, err error)
RefDescriptions(ctx context.Context, repositoryID int, pointedAt ...string) (_ map[string][]gitdomain.RefDescription, err error)
ListTags(ctx context.Context, repo api.RepoName, commitObjs ...string) (_ []*gitdomain.Tag, err error)
DirectoryChildren(ctx context.Context, repositoryID int, commit string, dirnames []string) (map[string][]string, error)
CommitDate(ctx context.Context, repositoryID int, commit string) (string, time.Time, bool, error)
ResolveRevision(ctx context.Context, repositoryID int, versionString string) (api.CommitID, error)
DefaultBranchContains(ctx context.Context, repositoryID int, commit string) (bool, error)
CommitsUniqueToBranch(ctx context.Context, repositoryID int, branchName string, isDefaultBranch bool, maxAge *time.Time) (map[string]time.Time, error)
Head(ctx context.Context, repositoryID int) (string, bool, error)
CommitExists(ctx context.Context, repositoryID int, commit string) (bool, error)
ListFiles(ctx context.Context, repositoryID int, commit string, pattern *regexp.Regexp) ([]string, error)
FileExists(ctx context.Context, repositoryID int, commit, file string) (bool, error)
RawContents(ctx context.Context, repositoryID int, commit, file string) ([]byte, error)
ArchiveReader(ctx context.Context, checker authz.SubRepoPermissionChecker, repo api.RepoName, options gitserver.ArchiveOptions) (io.ReadCloser, error)
RequestRepoUpdate(context.Context, api.RepoName, time.Duration) (*protocol.RepoUpdateResponse, error)
}
type RepoStore interface {
Get(ctx context.Context, repo api.RepoID) (_ *types.Repo, err error)
ResolveRev(ctx context.Context, repo *types.Repo, rev string) (api.CommitID, error)
}
type UploadServiceForExpiration interface {
// Uploads
GetUploads(ctx context.Context, opts codeinteltypes.GetUploadsOptions) (uploads []codeinteltypes.Upload, totalCount int, err error)
UpdateUploadRetention(ctx context.Context, protectedIDs, expiredIDs []int) (err error)
BackfillReferenceCountBatch(ctx context.Context, batchSize int) error
// Commits
GetCommitsVisibleToUpload(ctx context.Context, uploadID, limit int, token *string) (_ []string, nextToken *string, err error)
// Repositories
SetRepositoriesForRetentionScan(ctx context.Context, processDelay time.Duration, limit int) (_ []int, err error)
}
type PolicyService interface {
GetConfigurationPolicies(ctx context.Context, opts codeinteltypes.GetConfigurationPoliciesOptions) ([]codeinteltypes.ConfigurationPolicy, int, error)
}
type PolicyMatcher interface {
CommitsDescribedByPolicy(ctx context.Context, repositoryID int, policies []codeinteltypes.ConfigurationPolicy, now time.Time, filterCommits ...string) (map[string][]policies.PolicyMatch, error)
}
type UploadServiceForCleanup interface {
GetStaleSourcedCommits(ctx context.Context, threshold time.Duration, limit int, now time.Time) ([]sharedUploads.SourcedCommits, error)
DeleteSourcedCommits(ctx context.Context, repositoryID int, commit string, maximumCommitLag time.Duration, now time.Time) (int, int, error)
UpdateSourcedCommits(ctx context.Context, repositoryID int, commit string, now time.Time) (int, error)
DeleteUploadsWithoutRepository(ctx context.Context, now time.Time) (map[int]int, error)
DeleteUploadsStuckUploading(ctx context.Context, uploadedBefore time.Time) (int, error)
SoftDeleteExpiredUploads(ctx context.Context) (int, error)
HardDeleteExpiredUploads(ctx context.Context) (int, error)
DeleteOldAuditLogs(ctx context.Context, maxAge time.Duration, now time.Time) (int, error)
// Workerutil
WorkerutilStore() dbworkerstore.Store
}
type AutoIndexingService interface {
GetStaleSourcedCommits(ctx context.Context, threshold time.Duration, limit int, now time.Time) ([]sharedIndexes.SourcedCommits, error)
DeleteSourcedCommits(ctx context.Context, repositoryID int, commit string, maximumCommitLag time.Duration, now time.Time) (int, error)
UpdateSourcedCommits(ctx context.Context, repositoryID int, commit string, now time.Time) (int, error)
DeleteIndexesWithoutRepository(ctx context.Context, now time.Time) (map[int]int, error)
}
type RepoUpdaterClient interface {
EnqueueRepoUpdate(ctx context.Context, repo api.RepoName) (*protocol.RepoUpdateResponse, error)
}