|
| 1 | +package state |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + "time" |
| 6 | + |
| 7 | + "github.com/LAA-Software-Engineering/agentic-control-plane/internal/spec" |
| 8 | +) |
| 9 | + |
| 10 | +// DeploymentStore persists deployment rows from design doc §14.1 (applied_resources, applied_projects). |
| 11 | +// |
| 12 | +// Thread-safety: MVP targets a single-process CLI. Implementations are not required to support |
| 13 | +// arbitrary concurrent callers; treat the store as non-thread-safe unless a backend documents otherwise. |
| 14 | +type DeploymentStore interface { |
| 15 | + UpsertAppliedResource(ctx context.Context, r AppliedResource) error |
| 16 | + GetAppliedResource(ctx context.Context, env string, id spec.ResourceID) (*AppliedResource, error) |
| 17 | + ListAppliedResourcesByEnv(ctx context.Context, env string) ([]AppliedResource, error) |
| 18 | + UpsertAppliedProject(ctx context.Context, p AppliedProject) error |
| 19 | + GetAppliedProject(ctx context.Context, env, projectName string) (*AppliedProject, error) |
| 20 | +} |
| 21 | + |
| 22 | +// RuntimeStore persists execution rows from design doc §14.2 (runs, run_steps, trace_events). |
| 23 | +// |
| 24 | +// Thread-safety: same expectations as [DeploymentStore]. |
| 25 | +type RuntimeStore interface { |
| 26 | + StartRun(ctx context.Context, r Run) error |
| 27 | + FinishRun(ctx context.Context, runID, status string, finishedAt time.Time, outputJSON, errorText string, totalCostUSD float64) error |
| 28 | + UpsertRunStep(ctx context.Context, st RunStep) error |
| 29 | + AppendTraceEvent(ctx context.Context, runID string, ts time.Time, eventType string, stepID string, dataJSON string) (seq int64, err error) |
| 30 | + GetRun(ctx context.Context, runID string) (*Run, error) |
| 31 | + ListTraceEventsByRunID(ctx context.Context, runID string) ([]TraceEvent, error) |
| 32 | +} |
0 commit comments