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

Method Reset

batch.go:186–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184}
185
186func (wb *WriteBatch) Reset() error {
187 wb.Lock()
188 defer wb.Unlock()
189
190 wb.finished = false
191
192 // Unregister old transaction
193 if wb.tx != nil {
194 wb.db.transactionMgr.UnregisterTx(wb.txID)
195 }
196
197 // Create new transaction via TransactionManager
198 // needLock=false because Put()/Delete() will acquire lock before operations
199 var err error
200 wb.tx, err = wb.db.transactionMgr.BeginTx(true, false)
201 if err != nil {
202 return err
203 }
204 wb.txID = wb.tx.id
205 wb.throttle = NewThrottle(DefaultThrottleSize)
206 return err
207}
208
209// Error returns any errors encountered so far. No commits would be run once an error is detected.
210func (wb *WriteBatch) Error() error {

Callers 7

mainFunction · 0.95
writeEntryMethod · 0.45
CommitMethod · 0.45
runMethod · 0.45
SetMergeIntervalMethod · 0.45
parseDataFilesMethod · 0.45

Calls 3

NewThrottleFunction · 0.85
UnregisterTxMethod · 0.80
BeginTxMethod · 0.80

Tested by 1