Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
permissions-center: use consistent naming of permissions sync jobs. (#…
Browse files Browse the repository at this point in the history
…48123)

Test plan:
CI.
  • Loading branch information
sashaostrikov authored Feb 23, 2023
1 parent ed16bc5 commit 3c31223
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 242 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All notable changes to Sourcegraph are documented in this file.

### Changed

- Experimental GraphQL query, `permissionsSyncJobs` is removed and substituted with new non-experimental `permissionSyncJobs` query (mind the singular form of permission) which provides full information about permission sync jobs stored in the database. [#47933](https://github.com/sourcegraph/sourcegraph/pull/47933)
- Experimental GraphQL query, `permissionsSyncJobs` is substituted with new non-experimental query which provides full information about permissions sync jobs stored in the database. [#47933](https://github.com/sourcegraph/sourcegraph/pull/47933)
- Renders `readme.txt` files in the repository page. [#47944](https://github.com/sourcegraph/sourcegraph/pull/47944)

### Fixed
Expand All @@ -33,7 +33,7 @@ All notable changes to Sourcegraph are documented in this file.

- The LSIF upload endpoint is no longer supported and has been replaced by a diagnostic error page. src-cli v4.5+ will translate all local LSIF files to SCIP prior to upload. [#47547](https://github.com/sourcegraph/sourcegraph/pull/47547)
- The experimental setting `authz.syncJobsRecordsLimit` has been removed. [#47933](https://github.com/sourcegraph/sourcegraph/pull/47933)
- Storing permission sync jobs statuses in Redis has been removed as now all permission sync related data is stored in a database. [#47933](https://github.com/sourcegraph/sourcegraph/pull/47933)
- Storing permissions sync jobs statuses in Redis has been removed as now all permissions sync related data is stored in a database. [#47933](https://github.com/sourcegraph/sourcegraph/pull/47933)

## 4.5.0

Expand Down
2 changes: 1 addition & 1 deletion cmd/frontend/backend/user_emails.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ Please verify your email address on Sourcegraph ({{.Host}}) by clicking this lin

// triggerPermissionsSync is a helper that attempts to schedule a new permissions
// sync for the given user.
func triggerPermissionsSync(ctx context.Context, logger log.Logger, db database.DB, userID int32, reason database.PermissionSyncJobReason) {
func triggerPermissionsSync(ctx context.Context, logger log.Logger, db database.DB, userID int32, reason database.PermissionsSyncJobReason) {
permssync.SchedulePermsSync(ctx, logger, db, protocol.PermsSyncRequest{
UserIDs: []int32{userID},
Reason: reason,
Expand Down
2 changes: 1 addition & 1 deletion cmd/frontend/graphqlbackend/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type AuthzResolver interface {
AuthorizedUsers(ctx context.Context, args *RepoAuthorizedUserArgs) (UserConnectionResolver, error)
BitbucketProjectPermissionJobs(ctx context.Context, args *BitbucketProjectPermissionJobsArgs) (BitbucketProjectsPermissionJobsResolver, error)
AuthzProviderTypes(ctx context.Context) ([]string, error)
PermissionSyncJobs(ctx context.Context, args ListPermissionSyncJobsArgs) (*graphqlutil.ConnectionResolver[PermissionSyncJobResolver], error)
PermissionsSyncJobs(ctx context.Context, args ListPermissionsSyncJobsArgs) (*graphqlutil.ConnectionResolver[PermissionsSyncJobResolver], error)

// Helpers
RepositoryPermissionsInfo(ctx context.Context, repoID graphql.ID) (PermissionsInfoResolver, error)
Expand Down
28 changes: 14 additions & 14 deletions cmd/frontend/graphqlbackend/authz.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ extend type Query {
"""
Returns a list of recent permissions sync jobs for a given set of parameters.
"""
permissionSyncJobs(
permissionsSyncJobs(
"""
Number of jobs returned. Maximum number of returned jobs is 500. Up to 100 jobs are returned by default.
"""
Expand All @@ -161,7 +161,7 @@ extend type Query {
also used in conjunction with "last" to return the last N nodes.
"""
before: String
): PermissionSyncJobsConnection!
): PermissionsSyncJobsConnection!

"""
Returns a list of Bitbucket Project permissions sync jobs for a given set of parameters.
Expand Down Expand Up @@ -323,13 +323,13 @@ input FetchPermissionsOptions {
}

"""
Permission sync jobs.
Permissions sync jobs.
"""
type PermissionSyncJobsConnection implements Connection {
type PermissionsSyncJobsConnection implements Connection {
"""
Permission sync jobs.
"""
nodes: [PermissionSyncJob!]!
nodes: [PermissionsSyncJob!]!
"""
The total number of jobs in the connection.
"""
Expand All @@ -343,7 +343,7 @@ type PermissionSyncJobsConnection implements Connection {
"""
State types of permission sync jobs.
"""
enum PermissionSyncJobState {
enum PermissionsSyncJobState {
QUEUED
PROCESSING
FAILED
Expand All @@ -356,11 +356,11 @@ Compound type for a permission sync job trigger reason.
Consists of a reason group (PermissionSyncJobReasonGroup) and a message, providing details
about why/how the sync was triggered.
"""
type PermissionSyncJobReason {
type PermissionsSyncJobReason {
"""
PermissionSyncJobReasonGroup combines multiple permission sync job trigger reasons into groups with similar grounds.
"""
group: PermissionSyncJobReasonGroup!
group: PermissionsSyncJobReasonGroup!
"""
Message with details about why/how the sync was triggered.
"""
Expand All @@ -370,7 +370,7 @@ type PermissionSyncJobReason {
"""
State types of permission sync jobs.
"""
enum PermissionSyncJobReasonGroup {
enum PermissionsSyncJobReasonGroup {
MANUAL
WEBHOOK
SCHEDULE
Expand All @@ -385,7 +385,7 @@ union PermissionSyncJobSubject = User | Repository
"""
Permission sync job priority.
"""
enum PermissionSyncJobPriority {
enum PermissionsSyncJobPriority {
LOW
MEDIUM
HIGH
Expand Down Expand Up @@ -416,23 +416,23 @@ type CodeHostState {
"""
State of a permission sync job.
"""
type PermissionSyncJob implements Node {
type PermissionsSyncJob implements Node {
"""
Unique node ID.
"""
id: ID!
"""
State of a permission sync job.
"""
state: PermissionSyncJobState!
state: PermissionsSyncJobState!
"""
Failure message for failed sync job.
"""
failureMessage: String
"""
Reason for triggering a permission sync job.
"""
reason: PermissionSyncJobReason!
reason: PermissionsSyncJobReason!
"""
Reason for cancellation of a given permission sync job.
"""
Expand Down Expand Up @@ -488,7 +488,7 @@ type PermissionSyncJob implements Node {
"""
Priority of a permission sync job.
"""
priority: PermissionSyncJobPriority!
priority: PermissionsSyncJobPriority!
"""
Flag showing that there are no permissions for a given repository/user.
"""
Expand Down
4 changes: 2 additions & 2 deletions cmd/frontend/graphqlbackend/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ func (r *NodeResolver) ToBatchSpecWorkspaceFile() (BatchWorkspaceFileResolver, b
return n, ok
}

func (r *NodeResolver) ToPermissionSyncJob() (PermissionSyncJobResolver, bool) {
n, ok := r.Node.(PermissionSyncJobResolver)
func (r *NodeResolver) ToPermissionsSyncJob() (PermissionsSyncJobResolver, bool) {
n, ok := r.Node.(PermissionsSyncJobResolver)
return n, ok
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
)

// PermissionSyncJobResolver is used to resolve permission sync jobs.
// PermissionsSyncJobResolver is used to resolve permission sync jobs.
//
// TODO(sashaostrikov) add PermissionSyncJobProvider when it is persisted in the
// TODO(sashaostrikov) add PermissionsSyncJobProvider when it is persisted in the
// db.
type PermissionSyncJobResolver interface {
type PermissionsSyncJobResolver interface {
ID() graphql.ID
State() string
FailureMessage() *string
Reason() PermissionSyncJobReasonResolver
Reason() PermissionsSyncJobReasonResolver
CancellationReason() *string
TriggeredByUser(ctx context.Context) (*UserResolver, error)
QueuedAt() gqlutil.DateTime
Expand All @@ -29,7 +29,7 @@ type PermissionSyncJobResolver interface {
LastHeartbeatAt() *gqlutil.DateTime
WorkerHostname() string
Cancel() bool
Subject() PermissionSyncJobSubject
Subject() PermissionsSyncJobSubject
Priority() string
NoPerms() bool
InvalidateCaches() bool
Expand All @@ -39,7 +39,7 @@ type PermissionSyncJobResolver interface {
CodeHostStates() []CodeHostStateResolver
}

type PermissionSyncJobReasonResolver interface {
type PermissionsSyncJobReasonResolver interface {
Group() string
Message() string
}
Expand All @@ -51,11 +51,11 @@ type CodeHostStateResolver interface {
Message() string
}

type PermissionSyncJobSubject interface {
type PermissionsSyncJobSubject interface {
ToRepository() (*RepositoryResolver, bool)
ToUser() (*UserResolver, bool)
}

type ListPermissionSyncJobsArgs struct {
type ListPermissionsSyncJobsArgs struct {
graphqlutil.ConnectionResolverArgs
}
6 changes: 3 additions & 3 deletions cmd/repo-updater/shared/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type EnterpriseInit func(
keyring keyring.Ring,
cf *httpcli.Factory,
server *repoupdater.Server,
) (map[string]debugserver.Dumper, func(ctx context.Context, repo api.RepoID, syncReason database.PermissionSyncJobReason) error)
) (map[string]debugserver.Dumper, func(ctx context.Context, repo api.RepoID, syncReason database.PermissionsSyncJobReason) error)

type LazyDebugserverEndpoint struct {
repoUpdaterStateEndpoint http.HandlerFunc
Expand Down Expand Up @@ -157,7 +157,7 @@ func Main(ctx context.Context, observationCtx *observation.Context, ready servic

// All dependencies ready
debugDumpers := make(map[string]debugserver.Dumper)
var enqueueRepoPerms func(context.Context, api.RepoID, database.PermissionSyncJobReason) error
var enqueueRepoPerms func(context.Context, api.RepoID, database.PermissionsSyncJobReason) error
if enterpriseInit != nil {
debugDumpers, enqueueRepoPerms = enterpriseInit(observationCtx, db, store, keyring.Default(), cf, server)
}
Expand Down Expand Up @@ -450,7 +450,7 @@ func watchSyncer(
logger log.Logger,
syncer *repos.Syncer,
sched *repos.UpdateScheduler,
enqueueRepoPermsJob func(ctx context.Context, repo api.RepoID, syncReason database.PermissionSyncJobReason) error,
enqueueRepoPermsJob func(ctx context.Context, repo api.RepoID, syncReason database.PermissionsSyncJobReason) error,
changesetSyncer batches.UnarchivedChangesetSyncRegistry,
) {
logger.Debug("started new repo syncer updates scheduler relay thread")
Expand Down
Loading

0 comments on commit 3c31223

Please sign in to comment.