()
| 465 | } |
| 466 | |
| 467 | func (tx *Tx) allocCommitBuffer() *bytes.Buffer { |
| 468 | var buff *bytes.Buffer |
| 469 | |
| 470 | if tx.size < tx.db.opt.CommitBufferSize { |
| 471 | buff = tx.db.commitBuffer |
| 472 | } else { |
| 473 | buff = new(bytes.Buffer) |
| 474 | // avoid grow |
| 475 | buff.Grow(int(tx.size)) |
| 476 | } |
| 477 | |
| 478 | return buff |
| 479 | } |
| 480 | |
| 481 | // rotateActiveFile rotates log file when active file is not enough space to store the entry. |
| 482 | func (tx *Tx) rotateActiveFile() error { |
no outgoing calls