Validate validates the pending graph to ensure it is appropriate for the engine. This should be called before Commit to avoid any surprises there! This prevents an error on Commit which could cause an engine shutdown.
()
| 191 | // engine. This should be called before Commit to avoid any surprises there! |
| 192 | // This prevents an error on Commit which could cause an engine shutdown. |
| 193 | func (obj *Engine) Validate() error { |
| 194 | for _, vertex := range obj.nextGraph.Vertices() { |
| 195 | res, ok := vertex.(engine.Res) |
| 196 | if !ok { |
| 197 | return fmt.Errorf("not a Res") |
| 198 | } |
| 199 | |
| 200 | if err := engine.Validate(res); err != nil { |
| 201 | return fmt.Errorf("%s did not Validate: %v", res, err) |
| 202 | } |
| 203 | } |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | // Apply a function to the pending graph. You must pass in a function which will |
| 208 | // receive this graph as input, and return an error if something does not |