models

package
v0.0.0-...-66da4ae Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STEP_VALIDATE_INPUT  = "validate-input.json"
	STEP_VALIDATE_OUTPUT = "validate-output.json"
)

Variables

This section is empty.

Functions

func ListProcessors

func ListProcessors(paths []string) []string

* An abstract "Processor" actually processes a Task or an Event. Given a * list of base paths, each subdirectory defines a task action or an event * handler. If two base paths contain the same subdir name, the processor * counts as one.

Types

type Event

type Event struct {
	Source  string
	Name    string
	Payload string
}

type Processor

type Processor struct {
	Status   string `json:"status"`
	Progress int    `json:"progress"`
	Steps    []Step `json:"-"`
}

func CreateEventHandler

func CreateEventHandler(eventName string, basePaths []string) Processor

func CreateOneStepProcessor

func CreateOneStepProcessor(stepName string) Processor

func CreateTaskProcessor

func CreateTaskProcessor(actionName string, actionPaths []string) Processor

func (*Processor) SetProgressAtStep

func (d *Processor) SetProgressAtStep(stepIndex int, stepProgress int) error

func (*Processor) SetStepWeight

func (d *Processor) SetStepWeight(stepName string, weight int) error

func (Processor) ToJSON

func (d Processor) ToJSON() []byte

type Step

type Step struct {
	Name   string
	Path   string
	Weight int
}

type Task

type Task struct {
	ID        string      `json:"id" structs:"id"`
	Action    string      `json:"action" structs:"action"`
	Data      interface{} `json:"data" structs:"data"`
	Extra     interface{} `json:"extra" structs:"extra"`
	Queue     string      `json:"queue" structs:"queue"`
	User      string      `json:"user" structs:"user"`
	Timestamp time.Time   `json:"timestamp" structs:"timestamp"`
	Parent    string      `json:"parent" structs:"parent"`
}

Jump to

Keyboard shortcuts

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