iop/apps/edge/internal/configrefresh/result.go
toki 6706b5e1da feat(edge): runtime reconnect config refresh 구현 및 테스트 개선
- Edge 노드 runtime 재연결 시 설정 리프레시 로직 구현
- configrefresh classify/result 모듈 개선
- bootstrap refresh_admin 및 runtime 관련 코드 refactor
- model_queue 및 edgecmd 테스트 개선
- 관련 test 파일의 assertion 및 mock 구조 개선
2026-06-21 23:19:05 +09:00

55 lines
2.1 KiB
Go

package configrefresh
// Status is the overall classification of a refresh operation.
type Status string
const (
// StatusApplied means all detected changes are mutable and were (or would be) applied live.
StatusApplied Status = "applied"
// StatusRestartRequired means at least one change requires a process restart.
StatusRestartRequired Status = "restart_required"
// StatusRejected means the candidate config failed to load or validate.
StatusRejected Status = "rejected"
)
// RejectedResult builds a rejected Result with stable, non-nil change and
// ops-report slices so the API/CLI JSON response is consistent across rejected
// paths (invalid request, load/validate failure, apply failure).
func RejectedResult(req Request, summary string) Result {
return Result{
Status: StatusRejected,
Mode: req.Mode,
RequestID: req.RequestID,
Summary: summary,
Changes: []Change{},
ChangedNodes: []string{},
ChangedProviders: []string{},
ChangedModels: []string{},
RestartRequiredPaths: []string{},
}
}
// Change describes one detected config diff and its classification.
type Change struct {
Path string `json:"path"`
Class Status `json:"class"`
Previous string `json:"previous,omitempty"`
Next string `json:"next,omitempty"`
}
// Result is the response from a refresh evaluate or apply operation.
type Result struct {
Status Status `json:"status"`
Mode Mode `json:"mode"`
RequestID string `json:"request_id,omitempty"`
Changes []Change `json:"changes"`
Summary string `json:"summary"`
// Derived ops-report fields let an operator confirm which node, provider,
// and model items changed and which paths force a restart, without parsing
// individual Change paths. They are stable, sorted, and always non-nil so
// the API/CLI JSON response is consistent across runs.
ChangedNodes []string `json:"changed_nodes"`
ChangedProviders []string `json:"changed_providers"`
ChangedModels []string `json:"changed_models"`
RestartRequiredPaths []string `json:"restart_required_paths"`
}