(size int)
| 286 | } |
| 287 | |
| 288 | func (p *TieredBufferPool) getPool(size int) bufferPool { |
| 289 | poolIdx := sort.Search(len(p.sizedPools), func(i int) bool { |
| 290 | return p.sizedPools[i].defaultSize >= size |
| 291 | }) |
| 292 | |
| 293 | if poolIdx == len(p.sizedPools) { |
| 294 | return &p.fallbackPool |
| 295 | } |
| 296 | |
| 297 | return p.sizedPools[poolIdx] |
| 298 | } |
| 299 | |
| 300 | // SimpleBufferPool is an implementation of the mem.BufferPool interface that |
| 301 | // attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to |