MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / allocCommitBuffer

Method allocCommitBuffer

tx.go:467–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

465}
466
467func (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.
482func (tx *Tx) rotateActiveFile() error {

Callers 2

CommitMethod · 0.95
TestTx_allocCommitBufferFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestTx_allocCommitBufferFunction · 0.64