scheduler

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scheduler defines schedulers to execute functions on DAGs based on a specific scheduling strategy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func[V any] func(V) error

Func is the function type called when visiting nodes of the DAG.

type Parallel

type Parallel[V any] struct {
	// contains filtered or unexported fields
}

Parallel is a parallel scheduler implementing the scheduler.S interface.

func NewParallel

func NewParallel[V any](d *dag.DAG[V], reverse bool) *Parallel[V]

NewParallel creates a new parallel scheduler for the given DAG.

func (*Parallel[V]) Run

func (s *Parallel[V]) Run(f Func[V]) error

Run executes the given function on each node of the DAG. Nodes are run in parallel, but no node is visted until all its precessors are done.

type S

type S[V any] interface {
	// Run executes a given function by a specific scheduling strategy.
	Run(Func[V]) error
}

S is the scheduler interface.

type Sequential

type Sequential[V any] struct {
	// contains filtered or unexported fields
}

Sequential is a sequential scheduler implementing the scheduler.S interface.

func NewSequential

func NewSequential[V any](d *dag.DAG[V], reverse bool) *Sequential[V]

NewSequential creates a new sequential scheduler for the given DAG.

func (*Sequential[V]) Run

func (s *Sequential[V]) Run(f Func[V]) error

Run executes the given function on each node of the DAG. Nodes are run sequentially by their topological order.

Directories

Path Synopsis
Package resource defines different concurrent access strategies for resources.
Package resource defines different concurrent access strategies for resources.

Jump to

Keyboard shortcuts

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