@@ -2,8 +2,6 @@ package prebuilds
2
2
3
3
import (
4
4
"context"
5
-
6
- "github.com/coder/coder/v2/coderd/database"
7
5
)
8
6
9
7
// ReconciliationOrchestrator manages the lifecycle of prebuild reconciliation.
@@ -21,33 +19,9 @@ type ReconciliationOrchestrator interface {
21
19
Stop (ctx context.Context , cause error )
22
20
}
23
21
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.
29
22
type Reconciler interface {
30
23
// ReconcileAll orchestrates the reconciliation of all prebuilds across all templates.
31
24
// It takes a global snapshot of the system state and then reconciles each preset
32
25
// 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.
35
26
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 )
53
27
}
0 commit comments