Skip to content

Commit

Permalink
Fixing issue in elastic driver
Browse files Browse the repository at this point in the history
  • Loading branch information
kellrott committed Mar 29, 2021
1 parent bce6abc commit 8fe98ae
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions elastic/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ func (es *Graph) GetEdge(id string, load bool) *gdbi.Edge {
log.WithFields(log.Fields{"error": err}).Error("GetEdge: unmarshal")
return nil
}

return gdbi.NewElementFromEdge(edge)
o := gdbi.NewElementFromEdge(edge)
o.Loaded = load
return o
}

// GetVertex gets vertex `id`
Expand All @@ -217,7 +218,9 @@ func (es *Graph) GetVertex(id string, load bool) *gdbi.Vertex {
return nil
}

return gdbi.NewElementFromVertex(vertex)
o := gdbi.NewElementFromVertex(vertex)
o.Loaded = load
return o
}

// GetEdgeList produces a channel of all edges in the graph
Expand Down Expand Up @@ -257,7 +260,9 @@ func (es *Graph) GetEdgeList(ctx context.Context, load bool) <-chan *gdbi.Edge {
if err != nil {
return err
}
o <- gdbi.NewElementFromEdge(edge)
i := gdbi.NewElementFromEdge(edge)
i.Loaded = load
o <- i
}
return nil
})
Expand Down Expand Up @@ -310,7 +315,9 @@ func (es *Graph) GetVertexList(ctx context.Context, load bool) <-chan *gdbi.Vert
if err != nil {
return fmt.Errorf("Failed to unmarshal vertex: %v", err)
}
o <- gdbi.NewElementFromVertex(vertex)
i := gdbi.NewElementFromVertex(vertex)
i.Loaded = load
o <- i
}
return nil
})
Expand Down Expand Up @@ -374,6 +381,7 @@ func (es *Graph) GetVertexChannel(ctx context.Context, req chan gdbi.ElementLook
r := batchMap[vertex.Gid]
for _, ri := range r {
ri.Vertex = gdbi.NewElementFromVertex(vertex)
ri.Vertex.Loaded = load
o <- ri
}
}
Expand Down Expand Up @@ -486,6 +494,7 @@ func (es *Graph) GetOutChannel(ctx context.Context, req chan gdbi.ElementLookup,
r := batchMap[vertex.Gid]
for _, ri := range r {
ri.Vertex = gdbi.NewElementFromVertex(vertex)
ri.Vertex.Loaded = load
o <- ri
}
}
Expand Down Expand Up @@ -597,6 +606,7 @@ func (es *Graph) GetInChannel(ctx context.Context, req chan gdbi.ElementLookup,
r := batchMap[vertex.Gid]
for _, ri := range r {
ri.Vertex = gdbi.NewElementFromVertex(vertex)
ri.Vertex.Loaded = load
o <- ri
}
}
Expand Down Expand Up @@ -672,6 +682,7 @@ func (es *Graph) GetOutEdgeChannel(ctx context.Context, req chan gdbi.ElementLoo
r := batchMap[edge.From]
for _, ri := range r {
ri.Edge = gdbi.NewElementFromEdge(edge)
ri.Edge.Loaded = load
o <- ri
}
}
Expand Down Expand Up @@ -747,6 +758,7 @@ func (es *Graph) GetInEdgeChannel(ctx context.Context, req chan gdbi.ElementLook
r := batchMap[edge.To]
for _, ri := range r {
ri.Edge = gdbi.NewElementFromEdge(edge)
ri.Edge.Loaded = load
o <- ri
}
}
Expand Down

0 comments on commit 8fe98ae

Please sign in to comment.