job

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 13 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 DatasetAPIClient added in v1.15.0

type DatasetAPIClient interface {
	PostInstance(ctx context.Context, serviceAuthToken string, newInstance *dataset.NewInstance) (instance *dataset.Instance, eTag string, err error)
	PutInstance(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, instanceID string, instance dataset.UpdateInstance, ifMatch string) (eTag string, err error)
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

DatasetAPIClient 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 RecipeAPIClient added in v1.15.0

type RecipeAPIClient interface {
	GetRecipe(ctx context.Context, userAuthToken, serviceAuthToken, recipeID string) (*recipe.Recipe, error)
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

RecipeAPIClient 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, datasetAPIURL string, datasetAPIClient DatasetAPIClient, recipeAPIClient RecipeAPIClient, urlBuilder *url.Builder, serviceAuthToken string) *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 instances corresponding to the recipe defined by recipeID in the provided job. A new instance will be posted to dataset api for each outputInstance defined in the recipe. Note that the provided job will be modified (ID, links and counts will be updated).

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