depgraph

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package depgraph provides a resource dependency graph suitable for scheduling work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

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

A Graph schedules work for a DAG of resources.

func New

func New(res catalog.Resource_List) (*Graph, error)

New builds a graph from a list of dependencies or returns an error if the dependency information contains inconsistencies.

func (*Graph) Done

func (g *Graph) Done() bool

Done returns true if all of the resources in the graph have been marked.

func (*Graph) Mark

func (g *Graph) Mark(id uint64)

Mark marks a resource as "completed".

func (*Graph) MarkFailure

func (g *Graph) MarkFailure(id uint64) []uint64

Mark marks a resource as "completed with failure" and returns the list of resource IDs that depended on this resource, either directly or indirectly. Any resource on the returned list will never appear in the ready list.

func (*Graph) Ready

func (g *Graph) Ready() []uint64

Ready returns a list of resources that have not been marked and have no unmarked dependencies. This slice is only valid until the next mark call.

func (*Graph) Resource

func (g *Graph) Resource(id uint64) catalog.Resource

Resource returns the resource with the given ID.

Jump to

Keyboard shortcuts

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