engine: Resources package rewrite
This giant patch makes some much needed improvements to the code base. * The engine has been rewritten and lives within engine/graph/ * All of the common interfaces and code now live in engine/ * All of the resources are in one package called engine/resources/ * The Res API can use different "traits" from engine/traits/ * The Res API has been simplified to hide many of the old internals * The Watch & Process loops were previously inverted, but is now fixed * The likelihood of package cycles has been reduced drastically * And much, much more... Unfortunately, some code had to be temporarily removed. The remote code had to be taken out, as did the prometheus code. We hope to have these back in new forms as soon as possible.
This commit is contained in:
@@ -22,10 +22,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/purpleidea/mgmt/engine"
|
||||
"github.com/purpleidea/mgmt/lang/interfaces"
|
||||
"github.com/purpleidea/mgmt/lang/types"
|
||||
"github.com/purpleidea/mgmt/pgraph"
|
||||
"github.com/purpleidea/mgmt/resources"
|
||||
|
||||
multierr "github.com/hashicorp/go-multierror"
|
||||
errwrap "github.com/pkg/errors"
|
||||
@@ -103,7 +103,7 @@ func (obj *Edge) String() string {
|
||||
type Engine struct {
|
||||
Graph *pgraph.Graph
|
||||
Hostname string
|
||||
World resources.World
|
||||
World engine.World
|
||||
Debug bool
|
||||
Logf func(format string, v ...interface{})
|
||||
|
||||
@@ -161,15 +161,15 @@ func (obj *Engine) Init() error {
|
||||
return fmt.Errorf("vertex (%+v) was not an expr", vertex)
|
||||
}
|
||||
|
||||
if obj.Debug {
|
||||
obj.Logf("Loading func `%s`", vertex)
|
||||
}
|
||||
|
||||
obj.state[vertex] = &State{Expr: expr} // store some state!
|
||||
|
||||
if e := obj.state[vertex].Init(); e != nil {
|
||||
err = multierr.Append(err, e) // list of errors
|
||||
}
|
||||
|
||||
if obj.Debug {
|
||||
obj.Logf("Loading func `%s`", vertex)
|
||||
}
|
||||
}
|
||||
if err != nil { // usually due to `not found` errors
|
||||
return errwrap.Wrapf(err, "could not load requested funcs")
|
||||
|
||||
Reference in New Issue
Block a user