dag

package
v0.0.0-...-93ffe60 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Left  = 0
	Right = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DAG

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

func NewDAG

func NewDAG(logger Logger) *DAG

func (*DAG) Add

func (d *DAG) Add(pkg *packages.Package, includeTests bool) (*Node, error)

func (*DAG) CheckComplete

func (d *DAG) CheckComplete() error

func (*DAG) CheckForCycles

func (d *DAG) CheckForCycles() error

func (*DAG) Find

func (d *DAG) Find(importPath string) *Node

Find a Node by finding it and lock it. Callers of Find must release the lock.

func (*DAG) Obtain

func (d *DAG) Obtain(importPath string) *Node

Obtain a Node by finding it or creating it and lock it. Callers of Obtain must release the lock.

func (*DAG) Remove

func (d *DAG) Remove(importPath string) error

func (*DAG) VisitAll

func (d *DAG) VisitAll(ctx context.Context, v Visitor, concurrency int) error

VisitAll nodes in any order.

func (*DAG) VisitAllFromLeft

func (d *DAG) VisitAllFromLeft(ctx context.Context, v Visitor) error

VisitAllFromLeft visits each node from the left. NOTE: do not Lock/Unlock the node, VisitAllFromLeft will Lock it for you.

func (*DAG) VisitAllFromRight

func (d *DAG) VisitAllFromRight(ctx context.Context, v Visitor) error

VisitAllFromRight visits each node from the left. NOTE: do not Lock/Unlock the node, VisitAllFromRight will Lock it for you.

type Flags

type Flags uint32
const (
	Visited Flags = 1 << iota
)

type Generator

type Generator interface {
	Generate(context.Context, *Node, GoFile, io.WriteCloser) error
}

type GeneratorFunc

type GeneratorFunc func(context.Context, *Node, GoFile, io.WriteCloser) error

func (GeneratorFunc) Generate

func (g GeneratorFunc) Generate(ctx context.Context, node *Node, goFile GoFile, writer io.WriteCloser) error

type GoFile

type GoFile struct {
	Dir       string
	Filename  string
	Test      bool
	Generator Generator
}

type Import

type Import struct {
	*Node
	Test bool
}

type Logger

type Logger interface {
	Infof(format string, args ...interface{})
}

type Node

type Node struct {
	*NodeBits
	ImportPath string
	Deps       []*Node

	Mutex sync.RWMutex
	// contains filtered or unexported fields
}

type NodeBits

type NodeBits struct {
	Name      string
	Tests     bool
	SourceDir string
	RootDir   string
	Goroot    bool
	Standard  bool
	Intrinsic bool
	GoFiles   []GoFile
	SFiles    []SFile
	Imports   []Import
	ImportMap map[string]string

	Shlib string
	Meta  []interface{}
}

type SFile

type SFile struct {
	Dir      string
	Filename string
}

type VisitDirection

type VisitDirection int

type Visitor

type Visitor interface {
	Visit(context.Context, *Node) error
}

type VisitorFunc

type VisitorFunc func(context.Context, *Node) error

func (VisitorFunc) Visit

func (f VisitorFunc) Visit(ctx context.Context, n *Node) error

Jump to

Keyboard shortcuts

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