Exemplo n.º 1
0
func processUnify(g system.CoreGraph, u system.UnifyInstructionForm) uint64 {
	// only one scoping edge - the envlink
	edge, success := u.ScopingSpecs()[0].(EnvLink).Resolve(g, 0, emptyVT(u.Vertex()))
	if !success {
		// FIXME scoping edge resolution failure does not mean no match - there could be an orphan
		return 0
	}

	return findMatchingEnvId(g, edge, g.VerticesWith(q.Qbv(system.VType("process"), "pid", u.Vertex().Properties()["pid"])))
}
Exemplo n.º 2
0
func parentDatasetUnify(g system.CoreGraph, u system.UnifyInstructionForm) uint64 {
	edge, success := u.ScopingSpecs()[0].(EnvLink).Resolve(g, 0, emptyVT(u.Vertex()))
	if !success {
		// FIXME scoping edge resolution failure does not mean no match - there could be an orphan
		return 0
	}

	props := u.Vertex().Properties()
	return findMatchingEnvId(g, edge, g.VerticesWith(q.Qbv(system.VType("parent-dataset"), "path", props["path"], "name", props["name"])))
}
Exemplo n.º 3
0
func datasetUnify(g system.CoreGraph, u system.UnifyInstructionForm) uint64 {
	vtv := g.VerticesWith(q.Qbv(system.VType("dataset"), "name", u.Vertex().Properties()["name"]))
	if len(vtv) == 0 {
		return 0
	}

	spec := u.ScopingSpecs()[0].(specDatasetHierarchy)
	el, success := spec.Environment.Resolve(g, 0, emptyVT(u.Vertex()))
	// FIXME scoping edge resolution failure does not mean no match - there could be an orphan
	if success {
		for _, vt := range vtv {
			if id := findMatchingEnvId(g, el, g.SuccessorsWith(vt.ID, q.Qbe(system.EType("dataset-hierarchy")))); id != 0 {
				return vt.ID
			}
		}
	}

	return 0
}
Exemplo n.º 4
0
func commUnify(g system.CoreGraph, u system.UnifyInstructionForm) uint64 {
	// only one scoping edge - the envlink
	edge, success := u.ScopingSpecs()[0].(EnvLink).Resolve(g, 0, emptyVT(u.Vertex()))
	if !success {
		// FIXME scoping edge resolution failure does not mean no match - there could be an orphan
		return 0
	}

	vp := u.Vertex().Properties()
	typ, _ := vp["type"]
	path, haspath := vp["path"]
	if haspath {
		return findMatchingEnvId(g, edge, g.VerticesWith(q.Qbv(system.VType("comm"),
			"type", typ,
			"path", path)))
	} else {
		port, _ := vp["port"]
		return findMatchingEnvId(g, edge, g.VerticesWith(q.Qbv(system.VType("comm"),
			"type", typ,
			"port", port)))
	}
}