jobs

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanupService

type CleanupService struct {
	// contains filtered or unexported fields
}

func NewCleanupService

func NewCleanupService(jobService JobService, interval, maxAge time.Duration) *CleanupService

func (*CleanupService) Start

func (c *CleanupService) Start(ctx context.Context)

func (*CleanupService) Stop

func (c *CleanupService) Stop()

type JobFilters

type JobFilters struct {
	Status   string
	CourseID *uuid.UUID
	Limit    int
	Offset   int
}

type JobRepository

type JobRepository interface {
	Create(ctx context.Context, job *models.GenerationJob) error
	GetByID(ctx context.Context, id uuid.UUID) (*models.GenerationJob, error)
	List(ctx context.Context, filters JobFilters) ([]*models.GenerationJob, error)
	Update(ctx context.Context, job *models.GenerationJob) error
	UpdateStatus(ctx context.Context, id uuid.UUID, status models.JobStatus, progress int, errorMsg string) error
	DeleteOldJobs(ctx context.Context, olderThan time.Time) (int64, error)
}

func NewJobRepository

func NewJobRepository(db *gorm.DB) JobRepository

type JobService

type JobService interface {
	CreateJob(ctx context.Context, req *models.GenerationRequest) (*models.GenerationJob, error)
	GetJob(ctx context.Context, id uuid.UUID) (*models.GenerationJob, error)
	ListJobs(ctx context.Context, status string, courseID *uuid.UUID) ([]*models.GenerationJob, error)
	UpdateJobStatus(ctx context.Context, id uuid.UUID, status models.JobStatus, progress int, errorMsg string) error
	AddJobLog(ctx context.Context, id uuid.UUID, logEntry string) error
	CleanupOldJobs(ctx context.Context, maxAge time.Duration) (int64, error)
}

func NewJobServiceImpl

func NewJobServiceImpl(repo JobRepository) JobService

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL