mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Remove nsenter packages from vendor
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
70d49b4e47
commit
d4a67c05f3
18
vendor/github.com/prometheus/common/expfmt/text_create.go
generated
vendored
18
vendor/github.com/prometheus/common/expfmt/text_create.go
generated
vendored
@ -14,9 +14,10 @@
|
||||
package expfmt
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -27,7 +28,7 @@ import (
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
)
|
||||
|
||||
// enhancedWriter has all the enhanced write functions needed here. bytes.Buffer
|
||||
// enhancedWriter has all the enhanced write functions needed here. bufio.Writer
|
||||
// implements it.
|
||||
type enhancedWriter interface {
|
||||
io.Writer
|
||||
@ -37,14 +38,13 @@ type enhancedWriter interface {
|
||||
}
|
||||
|
||||
const (
|
||||
initialBufSize = 512
|
||||
initialNumBufSize = 24
|
||||
)
|
||||
|
||||
var (
|
||||
bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return bytes.NewBuffer(make([]byte, 0, initialBufSize))
|
||||
return bufio.NewWriter(ioutil.Discard)
|
||||
},
|
||||
}
|
||||
numBufPool = sync.Pool{
|
||||
@ -75,16 +75,14 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e
|
||||
}
|
||||
|
||||
// Try the interface upgrade. If it doesn't work, we'll use a
|
||||
// bytes.Buffer from the sync.Pool and write out its content to out in a
|
||||
// single go in the end.
|
||||
// bufio.Writer from the sync.Pool.
|
||||
w, ok := out.(enhancedWriter)
|
||||
if !ok {
|
||||
b := bufPool.Get().(*bytes.Buffer)
|
||||
b.Reset()
|
||||
b := bufPool.Get().(*bufio.Writer)
|
||||
b.Reset(out)
|
||||
w = b
|
||||
defer func() {
|
||||
bWritten, bErr := out.Write(b.Bytes())
|
||||
written = bWritten
|
||||
bErr := b.Flush()
|
||||
if err == nil {
|
||||
err = bErr
|
||||
}
|
||||
|
Reference in New Issue
Block a user