Files
atlas/internal/models/job.go
othman.suseno a6da313dfc
Some checks failed
CI / test-build (push) Failing after 59s
add api framework
2025-12-14 22:15:56 +07:00

29 lines
1020 B
Go

package models
import "time"
// JobStatus represents the state of a job
type JobStatus string
const (
JobStatusPending JobStatus = "pending"
JobStatusRunning JobStatus = "running"
JobStatusCompleted JobStatus = "completed"
JobStatusFailed JobStatus = "failed"
JobStatusCancelled JobStatus = "cancelled"
)
// Job represents a long-running asynchronous operation
type Job struct {
ID string `json:"id"`
Type string `json:"type"` // "pool_create", "snapshot_create", etc.
Status JobStatus `json:"status"`
Progress int `json:"progress"` // 0-100
Message string `json:"message"`
Error string `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}