MCPcopy Create free account
hub / github.com/djherbis/buffer / NewPartition

Function NewPartition

partition.go:17–22  ·  view source on GitHub ↗

NewPartition returns a Buffer which uses a Pool to extend or shrink its size as needed. It automatically allocates new buffers with pool.Get() to extend is length, and pool.Put() to release unused buffers as it shrinks.

(pool Pool, buffers ...Buffer)

Source from the content-addressed store, hash-verified

15// It automatically allocates new buffers with pool.Get() to extend is length, and
16// pool.Put() to release unused buffers as it shrinks.
17func NewPartition(pool Pool, buffers ...Buffer) Buffer {
18 return &partition{
19 Pool: pool,
20 List: buffers,
21 }
22}
23
24func (buf *partition) Cap() int64 {
25 return math.MaxInt64

Callers 6

TestFilePoolFunction · 0.85
TestFilePool2Function · 0.85
TestFilePartitionFunction · 0.85
TestMultiFunction · 0.85
TestBadPartitionFunction · 0.85
NewUnboundedBufferFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestFilePoolFunction · 0.68
TestFilePool2Function · 0.68
TestFilePartitionFunction · 0.68
TestMultiFunction · 0.68
TestBadPartitionFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…