Update github.com/blevesearch/bleve v1.0.13 -> v1.0.14 (#13947)
This commit is contained in:
parent
e46a638e8f
commit
3285babcae
101 changed files with 861 additions and 925 deletions
24
vendor/github.com/tinylib/msgp/msgp/write.go
generated
vendored
24
vendor/github.com/tinylib/msgp/msgp/write.go
generated
vendored
|
@ -10,6 +10,11 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// min buffer size for the writer
|
||||
minWriterSize = 18
|
||||
)
|
||||
|
||||
// Sizer is an interface implemented
|
||||
// by types that can estimate their
|
||||
// size when MessagePack encoded.
|
||||
|
@ -120,16 +125,27 @@ func NewWriter(w io.Writer) *Writer {
|
|||
|
||||
// NewWriterSize returns a writer with a custom buffer size.
|
||||
func NewWriterSize(w io.Writer, sz int) *Writer {
|
||||
// we must be able to require() 18
|
||||
// we must be able to require() 'minWriterSize'
|
||||
// contiguous bytes, so that is the
|
||||
// practical minimum buffer size
|
||||
if sz < 18 {
|
||||
sz = 18
|
||||
if sz < minWriterSize {
|
||||
sz = minWriterSize
|
||||
}
|
||||
buf := make([]byte, sz)
|
||||
return NewWriterBuf(w, buf)
|
||||
}
|
||||
|
||||
// NewWriterBuf returns a writer with a provided buffer.
|
||||
// 'buf' is not used when the capacity is smaller than 18,
|
||||
// custom buffer is allocated instead.
|
||||
func NewWriterBuf(w io.Writer, buf []byte) *Writer {
|
||||
if cap(buf) < minWriterSize {
|
||||
buf = make([]byte, minWriterSize)
|
||||
}
|
||||
buf = buf[:cap(buf)]
|
||||
return &Writer{
|
||||
w: w,
|
||||
buf: make([]byte, sz),
|
||||
buf: buf,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue