AllocSet is like Set(), but the caller must provide []byte parameters that came from Alloc(), for less buffer copying.
(keyFromAlloc, valFromAlloc []byte)
| 205 | // AllocSet is like Set(), but the caller must provide []byte |
| 206 | // parameters that came from Alloc(), for less buffer copying. |
| 207 | func (a *segment) AllocSet(keyFromAlloc, valFromAlloc []byte) error { |
| 208 | bufCap := cap(a.buf) |
| 209 | |
| 210 | keyStart := bufCap - cap(keyFromAlloc) |
| 211 | |
| 212 | return a.mutateEx(OperationSet, |
| 213 | keyStart, len(keyFromAlloc), len(valFromAlloc)) |
| 214 | } |
| 215 | |
| 216 | // AllocDel is like Del(), but the caller must provide []byte |
| 217 | // parameters that came from Alloc(), for less buffer copying. |