mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
Enable reconciliator on entitlements change
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
This commit is contained in:
@ -3,24 +3,18 @@ package prebuilds
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
)
|
||||
|
||||
type Reconciler interface {
|
||||
RunLoop(ctx context.Context)
|
||||
Stop(ctx context.Context, cause error)
|
||||
ReconcileAll(ctx context.Context) error
|
||||
}
|
||||
|
||||
type Claimer interface {
|
||||
Claim(ctx context.Context, store database.Store, userID uuid.UUID, name string, presetID uuid.UUID) (*uuid.UUID, error)
|
||||
Initiator() uuid.UUID
|
||||
}
|
||||
|
||||
type AGPLPrebuildClaimer struct{}
|
||||
|
||||
func (c AGPLPrebuildClaimer) Claim(context.Context, database.Store, uuid.UUID, string, uuid.UUID) (*uuid.UUID, error) {
|
||||
// Not entitled to claim prebuilds in AGPL version.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c AGPLPrebuildClaimer) Initiator() uuid.UUID {
|
||||
return uuid.Nil
|
||||
}
|
||||
|
||||
var DefaultClaimer Claimer = AGPLPrebuildClaimer{}
|
||||
|
22
coderd/prebuilds/claim.go
Normal file
22
coderd/prebuilds/claim.go
Normal file
@ -0,0 +1,22 @@
|
||||
package prebuilds
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
)
|
||||
|
||||
type AGPLPrebuildClaimer struct{}
|
||||
|
||||
func (c AGPLPrebuildClaimer) Claim(context.Context, database.Store, uuid.UUID, string, uuid.UUID) (*uuid.UUID, error) {
|
||||
// Not entitled to claim prebuilds in AGPL version.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c AGPLPrebuildClaimer) Initiator() uuid.UUID {
|
||||
return uuid.Nil
|
||||
}
|
||||
|
||||
var DefaultClaimer Claimer = AGPLPrebuildClaimer{}
|
18
coderd/prebuilds/reconcile.go
Normal file
18
coderd/prebuilds/reconcile.go
Normal file
@ -0,0 +1,18 @@
|
||||
package prebuilds
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type noopReconciler struct{}
|
||||
|
||||
func NewNoopReconciler() Reconciler {
|
||||
return &noopReconciler{}
|
||||
}
|
||||
|
||||
func (noopReconciler) RunLoop(context.Context) {}
|
||||
func (noopReconciler) Stop(context.Context, error) {}
|
||||
func (noopReconciler) ReconcileAll(context.Context) error { return nil }
|
||||
func (noopReconciler) ReconcileTemplate() error { return nil }
|
||||
|
||||
var _ Reconciler = noopReconciler{}
|
Reference in New Issue
Block a user