queue

package
v0.0.0-...-c1dbf63 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package queue implements the ordering logic to execute tensile.Node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue aggregates tensile.Node and then orders them based on their dependencies for execution.

func New

func New() *Queue

New returns a new Queue.

func (*Queue) Build

func (q *Queue) Build() (*Work, error)

Build returns the nodes in the queue in the order they should be executed. If there is a cycle in the graph, an error is returned.

func (*Queue) Depends

func (q *Queue) Depends(node any, dependsOn ...any) error

Depends adds a dependency from node to each of the nodes in dependsOn. If any of the nodes in dependsOn are not in the queue, an error is returned.

func (*Queue) Enqueue

func (q *Queue) Enqueue(nodes ...any) error

Enqueue adds a value as a tensile.Node to the queue.

type Work

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

Work is the result of building a queue.

func (*Work) Get

func (w *Work) Get() (*tensile.Node, bool)

Get returns the next node that is ready to be executed. If there are no nodes ready to be executed, it returns nil and false. If all nodes are done, it returns nil and true.

func (*Work) MarkDone

func (w *Work) MarkDone(node *tensile.Node)

MarkDone marks the given node as done. It should be called after a node has been executed.

Jump to

Keyboard shortcuts

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