Skip to content

Commit a825bf0

Browse files
refactor: reduce number of methods in Reconciler interface
1 parent 172177f commit a825bf0

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

coderd/prebuilds/api.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package prebuilds
22

33
import (
44
"context"
5-
6-
"github.com/coder/coder/v2/coderd/database"
75
)
86

97
// ReconciliationOrchestrator manages the lifecycle of prebuild reconciliation.
@@ -21,33 +19,9 @@ type ReconciliationOrchestrator interface {
2119
Stop(ctx context.Context, cause error)
2220
}
2321

24-
// Reconciler defines the core operations for managing prebuilds.
25-
// It provides both high-level orchestration (ReconcileAll) and lower-level operations
26-
// for more fine-grained control (SnapshotState, ReconcilePreset, CalculateActions).
27-
// All database operations must be performed within repeatable-read transactions
28-
// to ensure consistency.
2922
type Reconciler interface {
3023
// ReconcileAll orchestrates the reconciliation of all prebuilds across all templates.
3124
// It takes a global snapshot of the system state and then reconciles each preset
3225
// in parallel, creating or deleting prebuilds as needed to reach their desired states.
33-
// For more fine-grained control, you can use the lower-level methods SnapshotState
34-
// and ReconcilePreset directly.
3526
ReconcileAll(ctx context.Context) error
36-
37-
// SnapshotState captures the current state of all prebuilds across templates.
38-
// It creates a global database snapshot that can be viewed as a collection of PresetSnapshots,
39-
// each representing the state of prebuilds for a specific preset.
40-
// MUST be called inside a repeatable-read transaction.
41-
SnapshotState(ctx context.Context, store database.Store) (*GlobalSnapshot, error)
42-
43-
// ReconcilePreset handles a single PresetSnapshot, determining and executing
44-
// the required actions (creating or deleting prebuilds) based on the current state.
45-
// MUST be called inside a repeatable-read transaction.
46-
ReconcilePreset(ctx context.Context, snapshot PresetSnapshot) error
47-
48-
// CalculateActions determines what actions are needed to reconcile a preset's prebuilds
49-
// to their desired state. This includes creating new prebuilds, deleting excess ones,
50-
// or waiting due to backoff periods.
51-
// MUST be called inside a repeatable-read transaction.
52-
CalculateActions(ctx context.Context, state PresetSnapshot) (*ReconciliationActions, error)
5327
}

0 commit comments

Comments
 (0)