engine

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTaskTraceAttributes added in v0.3.10

func BuildTaskTraceAttributes(task Task) []attribute.KeyValue

Types

type Checkpoint

type Checkpoint struct {
	ID         string          `json:"id"`
	Network    network.Network `json:"network"`
	Worker     string          `json:"worker"`
	State      json.RawMessage `json:"state"`
	IndexCount int64           `json:"index_count"`
	UpdatedAt  time.Time       `json:"updated_at"`
}

type CheckpointTransformer

type CheckpointTransformer interface {
	Import(checkpoint *Checkpoint) error
	Export() (*Checkpoint, error)
}

type Source

type Source interface {
	Network() network.Network
	State() json.RawMessage
	Start(ctx context.Context, tasksChan chan<- *Tasks, errorChan chan<- error)
}

type SourceFilter

type SourceFilter interface{}

type Task

type Task interface {
	ID() string
	GetNetwork() network.Network
	GetTimestamp() uint64
	Validate() error
	BuildActivity(options ...activityx.Option) (*activityx.Activity, error)
}

type Tasks added in v0.3.10

type Tasks struct {
	Tasks []Task
	// contains filtered or unexported fields
}

func (*Tasks) Get added in v0.3.10

func (t *Tasks) Get(key string) string

func (*Tasks) Keys added in v0.3.10

func (t *Tasks) Keys() []string

func (*Tasks) Len added in v0.3.10

func (t *Tasks) Len() int

func (*Tasks) Set added in v0.3.10

func (t *Tasks) Set(key string, value string)

type Worker

type Worker interface {
	// Name is the name of the worker.
	Name() string
	// Platform returns the display name of the worker as the `platform` in the final Activity response.
	Platform() string
	// Network returns all networks where the worker runs on and displayed as the `network` in the final Activity response.
	Network() []network.Network
	// Tags the possible `tag` of the worker, displayed in the final Activity response.
	Tags() []tag.Tag
	// Types the possible `type` of the worker, displayed in the final Activity response.
	Types() []schema.Type
	// Filter the SourceFilter of the worker(network, state, start logics, etc.).
	Filter() SourceFilter
	// Match the matching logic of worker and returns if the task is matched
	Match(ctx context.Context, task Task) (bool, error)
	// Transform the core logic of the worker and returns the Activity.
	Transform(ctx context.Context, task Task) (*activityx.Activity, error)
}

Jump to

Keyboard shortcuts

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