Skip to content

Commit dfec884

Browse files
authored
Merge branch 'prebuilds-db' into 16930
2 parents e5117d7 + 73f99e8 commit dfec884

File tree

9 files changed

+230
-197
lines changed

9 files changed

+230
-197
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,13 +1137,13 @@ func (q *querier) BulkMarkNotificationMessagesSent(ctx context.Context, arg data
11371137
return q.db.BulkMarkNotificationMessagesSent(ctx, arg)
11381138
}
11391139

1140-
func (q *querier) ClaimPrebuild(ctx context.Context, newOwnerID database.ClaimPrebuildParams) (database.ClaimPrebuildRow, error) {
1140+
func (q *querier) ClaimPrebuiltWorkspace(ctx context.Context, newOwnerID database.ClaimPrebuiltWorkspaceParams) (database.ClaimPrebuiltWorkspaceRow, error) {
11411141
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceWorkspace); err != nil {
1142-
return database.ClaimPrebuildRow{
1142+
return database.ClaimPrebuiltWorkspaceRow{
11431143
ID: uuid.Nil,
11441144
}, err
11451145
}
1146-
return q.db.ClaimPrebuild(ctx, newOwnerID)
1146+
return q.db.ClaimPrebuiltWorkspace(ctx, newOwnerID)
11471147
}
11481148

11491149
func (q *querier) CleanTailnetCoordinators(ctx context.Context) error {
@@ -2298,11 +2298,11 @@ func (q *querier) GetReplicasUpdatedAfter(ctx context.Context, updatedAt time.Ti
22982298
return q.db.GetReplicasUpdatedAfter(ctx, updatedAt)
22992299
}
23002300

2301-
func (q *querier) GetRunningPrebuilds(ctx context.Context) ([]database.GetRunningPrebuildsRow, error) {
2301+
func (q *querier) GetRunningPrebuiltWorkspaces(ctx context.Context) ([]database.GetRunningPrebuiltWorkspacesRow, error) {
23022302
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceTemplate); err != nil {
23032303
return nil, err
23042304
}
2305-
return q.db.GetRunningPrebuilds(ctx)
2305+
return q.db.GetRunningPrebuiltWorkspaces(ctx)
23062306
}
23072307

23082308
func (q *querier) GetRuntimeConfig(ctx context.Context, key string) (string, error) {

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4800,8 +4800,8 @@ func (s *MethodTestSuite) TestNotifications() {
48004800
}
48014801

48024802
func (s *MethodTestSuite) TestPrebuilds() {
4803-
s.Run("ClaimPrebuild", s.Subtest(func(db database.Store, check *expects) {
4804-
check.Args(database.ClaimPrebuildParams{}).
4803+
s.Run("ClaimPrebuiltWorkspace", s.Subtest(func(db database.Store, check *expects) {
4804+
check.Args(database.ClaimPrebuiltWorkspaceParams{}).
48054805
Asserts(rbac.ResourceWorkspace, policy.ActionUpdate).
48064806
ErrorsWithInMemDB(dbmem.ErrUnimplemented).
48074807
ErrorsWithPG(sql.ErrNoRows)
@@ -4821,7 +4821,7 @@ func (s *MethodTestSuite) TestPrebuilds() {
48214821
Asserts(rbac.ResourceTemplate, policy.ActionRead).
48224822
ErrorsWithInMemDB(dbmem.ErrUnimplemented)
48234823
}))
4824-
s.Run("GetRunningPrebuilds", s.Subtest(func(_ database.Store, check *expects) {
4824+
s.Run("GetRunningPrebuiltWorkspaces", s.Subtest(func(_ database.Store, check *expects) {
48254825
check.Args().
48264826
Asserts(rbac.ResourceTemplate, policy.ActionRead).
48274827
ErrorsWithInMemDB(dbmem.ErrUnimplemented)

coderd/database/dbmem/dbmem.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,8 @@ func (*FakeQuerier) BulkMarkNotificationMessagesSent(_ context.Context, arg data
17401740
return int64(len(arg.IDs)), nil
17411741
}
17421742

1743-
func (*FakeQuerier) ClaimPrebuild(_ context.Context, _ database.ClaimPrebuildParams) (database.ClaimPrebuildRow, error) {
1744-
return database.ClaimPrebuildRow{}, ErrUnimplemented
1743+
func (q *FakeQuerier) ClaimPrebuiltWorkspace(ctx context.Context, arg database.ClaimPrebuiltWorkspaceParams) (database.ClaimPrebuiltWorkspaceRow, error) {
1744+
return database.ClaimPrebuiltWorkspaceRow{}, ErrUnimplemented
17451745
}
17461746

17471747
func (*FakeQuerier) CleanTailnetCoordinators(_ context.Context) error {
@@ -4880,7 +4880,7 @@ func (q *FakeQuerier) GetReplicasUpdatedAfter(_ context.Context, updatedAt time.
48804880
return replicas, nil
48814881
}
48824882

4883-
func (*FakeQuerier) GetRunningPrebuilds(_ context.Context) ([]database.GetRunningPrebuildsRow, error) {
4883+
func (q *FakeQuerier) GetRunningPrebuiltWorkspaces(ctx context.Context) ([]database.GetRunningPrebuiltWorkspacesRow, error) {
48844884
return nil, ErrUnimplemented
48854885
}
48864886

coderd/database/dbmetrics/querymetrics.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbmock/dbmock.go

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)