engine: graph: Add a function for printing Send/Recv logs
This commit is contained in:
@@ -124,6 +124,9 @@ func (obj *Engine) Process(ctx context.Context, vertex pgraph.Vertex) error {
|
|||||||
if updated, err := SendRecv(res); err != nil {
|
if updated, err := SendRecv(res); err != nil {
|
||||||
return errwrap.Wrapf(err, "could not SendRecv")
|
return errwrap.Wrapf(err, "could not SendRecv")
|
||||||
} else if len(updated) > 0 {
|
} else if len(updated) > 0 {
|
||||||
|
//for _, s := range graph.UpdatedStrings(updated) {
|
||||||
|
// obj.Logf("SendRecv: %s", s)
|
||||||
|
//}
|
||||||
for r, m := range updated { // map[engine.RecvableRes]map[string]*engine.Send
|
for r, m := range updated { // map[engine.RecvableRes]map[string]*engine.Send
|
||||||
v, ok := r.(pgraph.Vertex)
|
v, ok := r.(pgraph.Vertex)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -243,3 +243,19 @@ func TypeCmp(a, b reflect.Value) error {
|
|||||||
|
|
||||||
return nil // identical Type()'s
|
return nil // identical Type()'s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdatedStrings returns a list of strings showing what was updated after a
|
||||||
|
// Send/Recv run returned the updated datastructure. This is useful for logs.
|
||||||
|
func UpdatedStrings(updated map[engine.RecvableRes]map[string]*engine.Send) []string {
|
||||||
|
out := []string{}
|
||||||
|
for r, m := range updated { // map[engine.RecvableRes]map[string]*engine.Send
|
||||||
|
for s, send := range m {
|
||||||
|
if !send.Changed {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
x := fmt.Sprintf("%v.%s -> %v.%s", send.Res, send.Key, r, s)
|
||||||
|
out = append(out, x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user