job

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetRecipeFailed = errors.New("failed to get recipe")
	ErrSaveJobFailed   = errors.New("failed to save job")
)

A list of custom errors

Functions

func ErrCreateInstanceFailed

func ErrCreateInstanceFailed(datasetID string) error

ErrCreateInstanceFailed builds the message for an error when creating an instance

Types

type DatasetAPI

type DatasetAPI interface {
	CreateInstance(ctx context.Context, job *models.Job, recipeInst *models.RecipeInstance) (instance *models.Instance, err error)
	UpdateInstanceState(ctx context.Context, instanceID string, newState string) error
}

DatasetAPI interface to the dataset API.

type Queue

type Queue interface {
	Queue(ctx context.Context, job *models.ImportData) error
}

Queue interface used to queue import jobs.

type RecipeAPI

type RecipeAPI interface {
	GetRecipe(ctx context.Context, ID string) (*models.Recipe, error)
}

RecipeAPI interface to the recipe API.

type Service

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

Service provides job related functionality.

func NewService

func NewService(dataStore datastore.DataStorer, queue Queue, datasetAPI DatasetAPI, recipeAPI RecipeAPI, urlBuilder *url.Builder) *Service

NewService returns a new instance of a job.Service using the given dependencies.

func (Service) CreateJob

func (service Service) CreateJob(ctx context.Context, job *models.Job) (*models.Job, error)

CreateJob creates a new job using the given job instance.

func (Service) UpdateJob

func (service Service) UpdateJob(ctx context.Context, jobID string, job *models.Job) error

UpdateJob updates the job for the given jobID with the values in the given job model.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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