| 777 | ) |
| 778 | |
| 779 | func isDebug(ctx context.Context) bool { |
| 780 | var debug bool |
| 781 | |
| 782 | // gRPC client passes information about debug as metadata. |
| 783 | if md, ok := metadata.FromIncomingContext(ctx); ok { |
| 784 | // md is a map[string][]string |
| 785 | if len(md["debug"]) > 0 { |
| 786 | // We ignore the error here, because in error case, |
| 787 | // debug would be false which is what we want. |
| 788 | debug, _ = strconv.ParseBool(md["debug"][0]) |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | // HTTP passes information about debug as query parameter which is attached to context. |
| 793 | d, _ := ctx.Value(DebugKey).(bool) |
| 794 | return debug || d |
| 795 | } |
| 796 | |
| 797 | func (sg *SubGraph) populate(uids []uint64) error { |
| 798 | // Put sorted entries in matrix. |