engine: graph: Pass through the graph struct

We want to use it in the resources.
This commit is contained in:
James Shubin
2019-10-25 09:31:08 -04:00
parent dea8e63df2
commit 325ca03a13
3 changed files with 26 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ import (
// State stores some state about the resource it is mapped to.
type State struct {
// Graph is a pointer to the graph that this vertex is part of.
//Graph pgraph.Graph
Graph *pgraph.Graph
// Vertex is the pointer in the graph that this state corresponds to. It
// can be converted to a `Res` if necessary.
@@ -190,6 +190,16 @@ func (obj *State) Init() error {
return res.Recv()
},
// FIXME: pass in a safe, limited query func instead?
// TODO: not implemented, use FilteredGraph
//Graph: func() *pgraph.Graph {
// _, ok := obj.Vertex.(engine.CanGraphQueryRes)
// if !ok {
// panic("res does not support the GraphQuery trait")
// }
// return obj.Graph // we return in a func so it's fresh!
//},
World: obj.World,
VarDir: obj.varDir,