EncodeReadResponse writes a remote.Response to a http.ResponseWriter.
(resp *prompb.ReadResponse, w http.ResponseWriter)
| 90 | |
| 91 | // EncodeReadResponse writes a remote.Response to a http.ResponseWriter. |
| 92 | func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error { |
| 93 | data, err := proto.Marshal(resp) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | |
| 98 | compressed := snappy.Encode(nil, data) |
| 99 | _, err = w.Write(compressed) |
| 100 | return err |
| 101 | } |
| 102 | |
| 103 | // ToQuery builds a Query proto. |
| 104 | func ToQuery(from, to int64, matchers []*labels.Matcher, hints *storage.SelectHints) (*prompb.Query, error) { |
searching dependent graphs…