common

package
v1.40.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 9 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExtraLabels added in v1.40.1

func GetExtraLabels(req *http.Request) ([]prompbmarshal.Label, error)

GetExtraLabels extracts name:value labels from `extra_label=name=value` query args from req.

func GetGzipReader

func GetGzipReader(r io.Reader) (*gzip.Reader, error)

GetGzipReader returns new gzip reader from the pool.

Return back the gzip reader when it no longer needed with PutGzipReader.

func PutGzipReader

func PutGzipReader(zr *gzip.Reader)

PutGzipReader returns back gzip reader obtained via GetGzipReader.

func ReadLinesBlock

func ReadLinesBlock(r io.Reader, dstBuf, tailBuf []byte) ([]byte, []byte, error)

ReadLinesBlock reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.

Trailing chars after the last newline are put into tailBuf.

Returns (dstBuf, tailBuf).

It is expected that read timeout on r exceeds 1 second.

func ReadLinesBlockExt

func ReadLinesBlockExt(r io.Reader, dstBuf, tailBuf []byte, maxLineLen int) ([]byte, []byte, error)

ReadLinesBlockExt reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.

Trailing chars after the last newline are put into tailBuf.

Returns (dstBuf, tailBuf).

maxLineLen limits the maximum length of a single line.

It is expected that read timeout on r exceeds 1 second.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL