draft grpc
This commit is contained in:
26
internal/video/runtime/domain/agent.go
Normal file
26
internal/video/runtime/domain/agent.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type AgentStatus string
|
||||
|
||||
const (
|
||||
AgentStatusOnline AgentStatus = "online"
|
||||
AgentStatusOffline AgentStatus = "offline"
|
||||
AgentStatusBusy AgentStatus = "busy"
|
||||
)
|
||||
|
||||
type Agent struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Platform string `json:"platform"`
|
||||
Backend string `json:"backend"`
|
||||
Version string `json:"version"`
|
||||
Capacity int32 `json:"capacity"`
|
||||
Status AgentStatus `json:"status"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM float64 `json:"ram"`
|
||||
LastHeartbeat time.Time `json:"last_heartbeat"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
37
internal/video/runtime/domain/job.go
Normal file
37
internal/video/runtime/domain/job.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type JobStatus string
|
||||
|
||||
const (
|
||||
JobStatusPending JobStatus = "pending"
|
||||
JobStatusRunning JobStatus = "running"
|
||||
JobStatusSuccess JobStatus = "success"
|
||||
JobStatusFailure JobStatus = "failure"
|
||||
JobStatusCancelled JobStatus = "cancelled"
|
||||
)
|
||||
|
||||
type Job struct {
|
||||
ID string `json:"id" gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
|
||||
Status JobStatus `json:"status" gorm:"type:varchar(32);index"`
|
||||
Priority int `json:"priority" gorm:"default:0;index"`
|
||||
UserID string `json:"user_id" gorm:"index"`
|
||||
Name string `json:"name"`
|
||||
TimeLimit int64 `json:"time_limit"`
|
||||
InputURL string `json:"input_url"`
|
||||
OutputURL string `json:"output_url"`
|
||||
TotalDuration int64 `json:"total_duration"`
|
||||
CurrentTime int64 `json:"current_time"`
|
||||
Progress float64 `json:"progress"`
|
||||
AgentID *string `json:"agent_id" gorm:"type:uuid;index"`
|
||||
Logs string `json:"logs" gorm:"type:text"`
|
||||
Config string `json:"config" gorm:"type:text"`
|
||||
Cancelled bool `json:"cancelled" gorm:"default:false"`
|
||||
RetryCount int `json:"retry_count" gorm:"default:0"`
|
||||
MaxRetries int `json:"max_retries" gorm:"default:3"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (Job) TableName() string { return "render_jobs" }
|
||||
13
internal/video/runtime/domain/log.go
Normal file
13
internal/video/runtime/domain/log.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package domain
|
||||
|
||||
type LogEntry struct {
|
||||
JobID string `json:"job_id"`
|
||||
Line string `json:"line"`
|
||||
Progress float64 `json:"progress"`
|
||||
}
|
||||
|
||||
type SystemResource struct {
|
||||
AgentID string `json:"agent_id"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM float64 `json:"ram"`
|
||||
}
|
||||
Reference in New Issue
Block a user