MCPcopy Create free account
hub / github.com/cortexproject/cortex / Close

Method Close

pkg/api/queryapi/compression.go:36–52  ·  view source on GitHub ↗

Closes the compressedResponseWriter and ensures to flush all data before.

()

Source from the content-addressed store, hash-verified

34
35// Closes the compressedResponseWriter and ensures to flush all data before.
36func (c *compressedResponseWriter) Close() {
37 if zstdWriter, ok := c.writer.(*zstd.Encoder); ok {
38 zstdWriter.Flush()
39 }
40 if snappyWriter, ok := c.writer.(*snappy.Writer); ok {
41 snappyWriter.Flush()
42 }
43 if zlibWriter, ok := c.writer.(*zlib.Writer); ok {
44 zlibWriter.Flush()
45 }
46 if gzipWriter, ok := c.writer.(*gzip.Writer); ok {
47 gzipWriter.Flush()
48 }
49 if closer, ok := c.writer.(io.Closer); ok {
50 defer closer.Close()
51 }
52}
53
54// Constructs a new compressedResponseWriter based on client request headers.
55func newCompressedResponseWriter(writer http.ResponseWriter, req *http.Request) *compressedResponseWriter {

Callers

nothing calls this directly

Calls 2

FlushMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected