update dependencies (#296)

This commit is contained in:
tobi 2021-11-13 12:29:08 +01:00 committed by GitHub
commit 829a934d23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
124 changed files with 2453 additions and 1588 deletions

9
vendor/codeberg.org/gruf/go-pools/LICENSE generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2021 gruf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2
vendor/codeberg.org/gruf/go-pools/README.md generated vendored Normal file
View file

@ -0,0 +1,2 @@
A selection of type-defined `sync.Pool` implementations with redefined "getter" and "putter"
methods to handle their appropriate types.

75
vendor/codeberg.org/gruf/go-pools/bufio.go generated vendored Normal file
View file

@ -0,0 +1,75 @@
package pools
import (
"bufio"
"io"
"sync"
)
// BufioReaderPool is a pooled allocator for bufio.Reader objects
type BufioReaderPool interface {
// Get fetches a bufio.Reader from pool and resets to supplied reader
Get(io.Reader) *bufio.Reader
// Put places supplied bufio.Reader back in pool
Put(*bufio.Reader)
}
// NewBufioReaderPool returns a newly instantiated bufio.Reader pool
func NewBufioReaderPool(size int) BufioReaderPool {
return &bufioReaderPool{
Pool: sync.Pool{
New: func() interface{} {
return bufio.NewReaderSize(nil, size)
},
},
}
}
// bufioReaderPool is our implementation of BufioReaderPool
type bufioReaderPool struct{ sync.Pool }
func (p *bufioReaderPool) Get(r io.Reader) *bufio.Reader {
br := p.Pool.Get().(*bufio.Reader)
br.Reset(r)
return br
}
func (p *bufioReaderPool) Put(br *bufio.Reader) {
br.Reset(nil)
p.Pool.Put(br)
}
// BufioWriterPool is a pooled allocator for bufio.Writer objects
type BufioWriterPool interface {
// Get fetches a bufio.Writer from pool and resets to supplied writer
Get(io.Writer) *bufio.Writer
// Put places supplied bufio.Writer back in pool
Put(*bufio.Writer)
}
// NewBufioWriterPool returns a newly instantiated bufio.Writer pool
func NewBufioWriterPool(size int) BufioWriterPool {
return &bufioWriterPool{
Pool: sync.Pool{
New: func() interface{} {
return bufio.NewWriterSize(nil, size)
},
},
}
}
// bufioWriterPool is our implementation of BufioWriterPool
type bufioWriterPool struct{ sync.Pool }
func (p *bufioWriterPool) Get(w io.Writer) *bufio.Writer {
bw := p.Pool.Get().(*bufio.Writer)
bw.Reset(w)
return bw
}
func (p *bufioWriterPool) Put(bw *bufio.Writer) {
bw.Reset(nil)
p.Pool.Put(bw)
}

46
vendor/codeberg.org/gruf/go-pools/bytes.go generated vendored Normal file
View file

@ -0,0 +1,46 @@
package pools
import (
"sync"
"codeberg.org/gruf/go-bytes"
)
// BufferPool is a pooled allocator for bytes.Buffer objects
type BufferPool interface {
// Get fetches a bytes.Buffer from pool
Get() *bytes.Buffer
// Put places supplied bytes.Buffer in pool
Put(*bytes.Buffer)
}
// NewBufferPool returns a newly instantiated bytes.Buffer pool
func NewBufferPool(size int) BufferPool {
return &bufferPool{
pool: sync.Pool{
New: func() interface{} {
return &bytes.Buffer{B: make([]byte, 0, size)}
},
},
size: size,
}
}
// bufferPool is our implementation of BufferPool
type bufferPool struct {
pool sync.Pool
size int
}
func (p *bufferPool) Get() *bytes.Buffer {
return p.pool.Get().(*bytes.Buffer)
}
func (p *bufferPool) Put(buf *bytes.Buffer) {
if buf.Cap() < p.size {
return
}
buf.Reset()
p.pool.Put(buf)
}

46
vendor/codeberg.org/gruf/go-pools/fastpath.go generated vendored Normal file
View file

@ -0,0 +1,46 @@
package pools
import (
"sync"
"codeberg.org/gruf/go-fastpath"
)
// PathBuilderPool is a pooled allocator for fastpath.Builder objects
type PathBuilderPool interface {
// Get fetches a fastpath.Builder from pool
Get() *fastpath.Builder
// Put places supplied fastpath.Builder back in pool
Put(*fastpath.Builder)
}
// NewPathBuilderPool returns a newly instantiated fastpath.Builder pool
func NewPathBuilderPool(size int) PathBuilderPool {
return &pathBuilderPool{
pool: sync.Pool{
New: func() interface{} {
return &fastpath.Builder{B: make([]byte, 0, size)}
},
},
size: size,
}
}
// pathBuilderPool is our implementation of PathBuilderPool
type pathBuilderPool struct {
pool sync.Pool
size int
}
func (p *pathBuilderPool) Get() *fastpath.Builder {
return p.pool.Get().(*fastpath.Builder)
}
func (p *pathBuilderPool) Put(pb *fastpath.Builder) {
if pb.Cap() < p.size {
return
}
pb.Reset()
p.pool.Put(pb)
}