本文整理汇总了Golang中github.com/pipeviz/pipeviz/types/system.CoreGraph.OutWith方法的典型用法代码示例。如果您正苦于以下问题:Golang CoreGraph.OutWith方法的具体用法?Golang CoreGraph.OutWith怎么用?Golang CoreGraph.OutWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pipeviz/pipeviz/types/system.CoreGraph
的用法示例。
在下文中一共展示了CoreGraph.OutWith方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Resolve
func (spec specUnixDomainListener) Resolve(g system.CoreGraph, mid uint64, src system.VertexTuple) (e system.StdEdge, success bool) {
// check for existing edge; this one is quite straightforward
re := g.OutWith(src.ID, q.Qbe(system.EType("listening"), "type", "unix", "path", spec.Path))
if len(re) == 1 {
return re[0], true
}
e = system.StdEdge{
Source: src.ID,
Props: ps.NewMap(),
EType: "listening",
}
e.Props = e.Props.Set("path", system.Property{MsgSrc: mid, Value: spec.Path})
envid, _, hasenv := findEnv(g, src)
if hasenv {
rv := g.PredecessorsWith(envid, q.Qbv(system.VType("comm"), "type", "unix", "path", spec.Path))
if len(rv) == 1 {
success = true
e.Target = rv[0].ID
}
}
return
}
示例2: Resolve
func (spec specGitCommitParent) Resolve(g system.CoreGraph, mid uint64, src system.VertexTuple) (e system.StdEdge, success bool) {
e = system.StdEdge{
Source: src.ID,
Props: ps.NewMap(),
EType: "parent-commit",
}
re := g.OutWith(src.ID, q.Qbe(system.EType("parent-commit"), "pnum", spec.ParentNum))
if len(re) > 0 {
success = true
e.Target = re[0].Target
e.Props = re[0].Props
// FIXME evidence of a problem here - since we're using pnum as the deduping identifier, there's no
// way it could also sensibly change its MsgSrc value. This is very much a product of the intensional/extensional
// identity problem: what does it mean to have the identifying data change? is it now a new thing? was it the old thing,
// and it underwent a transition into the new thing? or is there no distinction between the old and new thing?
e.Props = e.Props.Set("sha1", system.Property{MsgSrc: mid, Value: spec.Sha1})
e.ID = re[0].ID
} else {
rv := g.VerticesWith(q.Qbv(system.VType("commit"), "sha1", spec.Sha1))
if len(rv) == 1 {
success = true
e.Target = rv[0].ID
e.Props = e.Props.Set("pnum", system.Property{MsgSrc: mid, Value: spec.ParentNum})
e.Props = e.Props.Set("sha1", system.Property{MsgSrc: mid, Value: spec.Sha1})
}
}
return
}
示例3: Resolve
func (spec specCommit) Resolve(g system.CoreGraph, mid uint64, src system.VertexTuple) (e system.StdEdge, success bool) {
e = system.StdEdge{
Source: src.ID,
Props: ps.NewMap(),
EType: "version",
}
e.Props = e.Props.Set("sha1", system.Property{MsgSrc: mid, Value: spec.Sha1})
re := g.OutWith(src.ID, q.Qbe(system.EType("version")))
if len(re) > 0 {
sha1, _ := re[0].Props.Lookup("sha1")
e.ID = re[0].ID // FIXME setting the id to non-0 AND failing is currently unhandled
if sha1.(system.Property).Value == spec.Sha1 {
success = true
e.Target = re[0].Target
} else {
rv := g.VerticesWith(q.Qbv(system.VType("commit"), "sha1", spec.Sha1))
if len(rv) == 1 {
success = true
e.Target = rv[0].ID
}
}
} else {
rv := g.VerticesWith(q.Qbv(system.VType("commit"), "sha1", spec.Sha1))
if len(rv) == 1 {
success = true
e.Target = rv[0].ID
}
}
return
}
示例4: findMatchingEnvId
func findMatchingEnvId(g system.CoreGraph, edge system.StdEdge, vtv system.VertexTupleVector) uint64 {
for _, candidate := range vtv {
for _, edge2 := range g.OutWith(candidate.ID, q.Qbe(system.EType("envlink"))) {
if edge2.Target == edge.Target {
return candidate.ID
}
}
}
return 0
}
示例5: findEnv
// Searches the given vertex's out-edges to find its environment's vertex id.
//
// Also conveniently initializes a StandardEdge to the standard zero-state for an envlink.
func findEnv(g system.CoreGraph, vt system.VertexTuple) (vid uint64, edge system.StdEdge, success bool) {
edge = system.StdEdge{
Source: vt.ID,
Props: ps.NewMap(),
EType: "envlink",
}
if vt.ID != 0 {
re := g.OutWith(vt.ID, q.Qbe(system.EType("envlink")))
if len(re) == 1 {
vid, edge, success = re[0].Target, re[0], true
}
}
return
}
示例6: Resolve
func (spec DataAlpha) Resolve(g system.CoreGraph, mid uint64, src system.VertexTuple) (e system.StdEdge, success bool) {
// TODO this makes a loop...are we cool with that?
success = true // impossible to fail here
e = system.StdEdge{
Source: src.ID,
Target: src.ID,
Props: ps.NewMap(),
EType: "data-provenance",
}
re := g.OutWith(src.ID, q.Qbe(system.EType("data-provenance")))
if len(re) == 1 {
e = re[0]
}
return
}