github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/terraform/graph_walk.go (about)

     1  package terraform
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/dag"
     5  )
     6  
     7  // GraphWalker is an interface that can be implemented that when used
     8  // with Graph.Walk will invoke the given callbacks under certain events.
     9  type GraphWalker interface {
    10  	EnterPath([]string) EvalContext
    11  	ExitPath([]string)
    12  	EnterVertex(dag.Vertex)
    13  	ExitVertex(dag.Vertex, error)
    14  	EnterEvalTree(dag.Vertex, EvalNode) EvalNode
    15  	ExitEvalTree(dag.Vertex, interface{}, error) error
    16  }
    17  
    18  // NullGraphWalker is a GraphWalker implementation that does nothing.
    19  // This can be embedded within other GraphWalker implementations for easily
    20  // implementing all the required functions.
    21  type NullGraphWalker struct{}
    22  
    23  func (NullGraphWalker) EnterPath([]string) EvalContext                  { return nil }
    24  func (NullGraphWalker) ExitPath([]string)                               {}
    25  func (NullGraphWalker) EnterVertex(dag.Vertex)                          {}
    26  func (NullGraphWalker) ExitVertex(dag.Vertex, error)                    {}
    27  func (NullGraphWalker) EnterEvalTree(v dag.Vertex, n EvalNode) EvalNode { return n }
    28  func (NullGraphWalker) ExitEvalTree(dag.Vertex, interface{}, error) error {
    29  	return nil
    30  }