worker

package
v4.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package worker implements the generic cron worker logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResultFilename

func ResultFilename(sbr *data.ScorecardBatchRequest) string

ResultFilename returns the filename where the result from processing a batch request should go. This naming convention is used to detect duplicate requests, as well as transfer the results to BigQuery.

Types

type WorkLoop

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

WorkLoop is the entry point into the common cron worker structure.

func NewWorkLoop

func NewWorkLoop(worker Worker) WorkLoop

NewWorkLoop creates a workloop using a specified worker.

func (*WorkLoop) Run

func (wl *WorkLoop) Run() error

Run initiates the processing performed by the WorkLoop.

type Worker

type Worker interface {
	Process(ctx context.Context, req *data.ScorecardBatchRequest, bucketURL string) error
	PostProcess()
}

Worker is the interface used to process batch requests.

Process does the processing for a batch request. Returning an error will cause the request to be nack'd, allowing it to be re-processed later. If no error is returned, the request will be ack'd, consuming it.

PostProcess is called only after an error-free call to Process.

Jump to

Keyboard shortcuts

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