Documentation ¶
Index ¶
- func ParseProtoReader(ctx context.Context, reader io.Reader, expectedSize, maxSize int, ...) error
- func RenderHTTPResponse(w http.ResponseWriter, v interface{}, t *template.Template, r *http.Request)
- func SerializeProtoResponse(w http.ResponseWriter, resp proto.Message, compression CompressionType) error
- func WriteJSONResponse(w http.ResponseWriter, v interface{})
- type CompressionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseProtoReader ¶
func ParseProtoReader(ctx context.Context, reader io.Reader, expectedSize, maxSize int, req proto.Message, compression CompressionType) error
ParseProtoReader parses a compressed proto from an io.Reader.
func RenderHTTPResponse ¶
func RenderHTTPResponse(w http.ResponseWriter, v interface{}, t *template.Template, r *http.Request)
RenderHTTPResponse either responds with json or a rendered html page using the passed in template by checking the Accepts header
func SerializeProtoResponse ¶
func SerializeProtoResponse(w http.ResponseWriter, resp proto.Message, compression CompressionType) error
SerializeProtoResponse serializes a protobuf response into an HTTP response.
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, v interface{})
WriteJSONResponse writes some JSON as a HTTP response.
Types ¶
type CompressionType ¶
type CompressionType int
CompressionType for encoding and decoding requests and responses.
const ( NoCompression CompressionType = iota FramedSnappy RawSnappy )
Values for CompressionType
func CompressionTypeFor ¶
func CompressionTypeFor(version string) CompressionType
CompressionTypeFor a given version of the Prometheus remote storage protocol. See https://github.com/prometheus/prometheus/issues/2692.
Click to show internal directories.
Click to hide internal directories.