Documentation ¶
Index ¶
Constants ¶
const (
NoLimit = 0 // NoLimit denotes no limit imposed on the concurrency
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
Limit provides a generic concurrency / work limiter
type MemFile ¶
type MemFile struct {
// contains filtered or unexported fields
}
MemFile denotes an in-memory abstraction of an underlying file, acting as a buffer (drawing memory from a pool)
func NewMemFile ¶
func NewMemFile(r ReadWriteSeekCloser, pool MemPool) (*MemFile, error)
NewMemFile instantiates a new in-memory file buffer
func (*MemFile) Close ¶
Close fulfils the underlying io.Closer interface (returning the buffer to the pool)
type MemPoolGCable ¶
type MemPoolGCable interface { Clear() MemPool }
MemPoolGCable denotes a generic memory buffer pool that can be "cleaned", i.e. that allows making all resources available for garbage collection
type MemPoolLimit ¶
type MemPoolLimit struct {
// contains filtered or unexported fields
}
MemPoolLimit provides a channel-based memory buffer pool (limiting the number of resources and allowing for cleanup)
func NewMemPool ¶
func NewMemPool(n int) *MemPoolLimit
NewMemPool instantiates a new memory pool that manages bytes slices
func (*MemPoolLimit) Clear ¶
func (p *MemPoolLimit) Clear()
Clear releases all pool resources and makes them available for garbage collection
func (*MemPoolLimit) Get ¶
func (p *MemPoolLimit) Get(size int) (elem []byte)
Get retrieves a memory element (already performing the type assertion)
func (*MemPoolLimit) Put ¶
func (p *MemPoolLimit) Put(elem []byte)
Put returns a memory element to the pool, resetting its size to capacity in the process
type MemPoolNoLimit ¶
MemPoolNoLimit wraps a standard sync.Pool (no limit to resources)
func NewMemPoolNoLimit ¶
func NewMemPoolNoLimit() *MemPoolNoLimit
NewMemPoolNoLimit instantiates a new memory pool that manages bytes slices of arbitrary capacity
func (*MemPoolNoLimit) Get ¶
func (p *MemPoolNoLimit) Get(size int) (elem []byte)
Get retrieves a memory element (already performing the type assertion)
func (*MemPoolNoLimit) Put ¶
func (p *MemPoolNoLimit) Put(elem []byte)
Put returns a memory element to the pool, resetting its size to capacity in the process