mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
35 lines
599 B
Go
35 lines
599 B
Go
package blueprint
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type Blueprint struct {
|
|
execPool ExecPool
|
|
graphPool GraphPool
|
|
}
|
|
|
|
func (bm *Blueprint) Init(execDefFilePath string, graphFilePath string) error {
|
|
err := bm.execPool.Load(execDefFilePath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, e := range execNodes {
|
|
if !bm.execPool.Register(e) {
|
|
return fmt.Errorf("register exec failed,exec:%s", e.GetName())
|
|
}
|
|
}
|
|
|
|
err = bm.graphPool.Load(&bm.execPool, graphFilePath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (bm *Blueprint) Create(graphName string) IGraph {
|
|
return bm.graphPool.Create(graphName)
|
|
}
|