Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDBConnection = errors.New("database connection error") ErrDBQuery = errors.New("database query error") ErrDBScan = errors.New("database scan error") ErrCreate = errors.New("create error") ErrUpdate = errors.New("update error") ErrDelete = errors.New("delete error") ErrTaskNotFound = errors.New("task not found") ErrPropletNotFound = errors.New("proplet not found") ErrNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type Database ¶
func NewDatabase ¶
type JobRepository ¶
type JobRepository interface {
Create(ctx context.Context, j job.Job) (job.Job, error)
Get(ctx context.Context, id string) (job.Job, error)
List(ctx context.Context, offset, limit uint64) ([]job.Job, uint64, error)
Delete(ctx context.Context, id string) error
}
func NewJobRepository ¶
func NewJobRepository(db *Database) JobRepository
NewJobRepository returns a PostgreSQL-backed job repository.
type MetricsRepository ¶
type MetricsRepository interface {
CreateTaskMetrics(ctx context.Context, m TaskMetrics) error
CreatePropletMetrics(ctx context.Context, m PropletMetrics) error
ListTaskMetrics(ctx context.Context, taskID string, offset, limit uint64) ([]TaskMetrics, uint64, error)
ListPropletMetrics(ctx context.Context, propletID string, offset, limit uint64) ([]PropletMetrics, uint64, error)
}
func NewMetricsRepository ¶
func NewMetricsRepository(db *Database) MetricsRepository
type PropletMetrics ¶
type PropletMetrics struct {
PropletID string `json:"proplet_id"`
Namespace string `json:"namespace"`
Timestamp time.Time `json:"timestamp"`
CPU proplet.CPUMetrics `json:"cpu_metrics"`
Memory proplet.MemoryMetrics `json:"memory_metrics"`
}
type PropletRepository ¶
type PropletRepository interface {
Create(ctx context.Context, p proplet.Proplet) error
Get(ctx context.Context, id string) (proplet.Proplet, error)
Update(ctx context.Context, p proplet.Proplet) error
List(ctx context.Context, offset, limit uint64) ([]proplet.Proplet, uint64, error)
Delete(ctx context.Context, id string) error
}
func NewPropletRepository ¶
func NewPropletRepository(db *Database) PropletRepository
type Repositories ¶
type Repositories struct {
Tasks TaskRepository
Proplets PropletRepository
TaskProplets TaskPropletRepository
Jobs JobRepository
Metrics MetricsRepository
}
func NewRepositories ¶
func NewRepositories(db *Database) *Repositories
type TaskMetrics ¶
type TaskMetrics struct {
TaskID string `json:"task_id"`
PropletID string `json:"proplet_id"`
Metrics proplet.ProcessMetrics `json:"metrics"`
Aggregated *proplet.AggregatedMetrics `json:"aggregated,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
type TaskPropletRepository ¶
type TaskPropletRepository interface {
Create(ctx context.Context, taskID, propletID string) error
Get(ctx context.Context, taskID string) (string, error)
Delete(ctx context.Context, taskID string) error
}
func NewTaskPropletRepository ¶
func NewTaskPropletRepository(db *Database) TaskPropletRepository
type TaskRepository ¶
type TaskRepository interface {
Create(ctx context.Context, t task.Task) (task.Task, error)
Get(ctx context.Context, id string) (task.Task, error)
Update(ctx context.Context, t task.Task) error
List(ctx context.Context, offset, limit uint64) ([]task.Task, uint64, error)
ListByWorkflowID(ctx context.Context, workflowID string) ([]task.Task, error)
ListByJobID(ctx context.Context, jobID string) ([]task.Task, error)
Delete(ctx context.Context, id string) error
}
func NewTaskRepository ¶
func NewTaskRepository(db *Database) TaskRepository
Click to show internal directories.
Click to hide internal directories.