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

Method Rollback

tx.go:536–559  ·  view source on GitHub ↗

Rollback closes the transaction.

()

Source from the content-addressed store, hash-verified

534
535// Rollback closes the transaction.
536func (tx *Tx) Rollback() error {
537 if tx.db == nil {
538 tx.setStatusClosed()
539 return ErrDBClosed
540 }
541 if tx.isCommitting() {
542 return ErrCannotRollbackACommittingTx
543 }
544
545 if tx.isClosed() {
546 return ErrCannotRollbackAClosedTx
547 }
548
549 tx.setStatusClosed()
550 tx.unlock()
551
552 // Unregister from TransactionManager so active tracking stays correct
553 tx.db.transactionMgr.UnregisterTx(tx.id)
554
555 tx.db = nil
556 tx.pendingWrites = nil
557
558 return nil
559}
560
561// lock locks the database based on the transaction type.
562func (tx *Tx) lock() {

Callers 10

managedMethod · 0.95
TestTx_RangeScan_ErrFunction · 0.80
TestTx_Put_ErrFunction · 0.80
TestTx_RollbackFunction · 0.80
TestTx_BeginFunction · 0.80
TestTx_CloseFunction · 0.80
TestTx_allocCommitBufferFunction · 0.80
TestTx_putBucketFunction · 0.80
mainFunction · 0.80

Calls 5

setStatusClosedMethod · 0.95
isCommittingMethod · 0.95
isClosedMethod · 0.95
unlockMethod · 0.95
UnregisterTxMethod · 0.80

Tested by 8

TestTx_RangeScan_ErrFunction · 0.64
TestTx_Put_ErrFunction · 0.64
TestTx_RollbackFunction · 0.64
TestTx_BeginFunction · 0.64
TestTx_CloseFunction · 0.64
TestTx_allocCommitBufferFunction · 0.64
TestTx_putBucketFunction · 0.64