MCPcopy
hub / github.com/hashicorp/go-memdb / Abort

Method Abort

txn.go:110–128  ·  view source on GitHub ↗

Abort is used to cancel this transaction. This is a noop for read transactions, already aborted or commited transactions.

()

Source from the content-addressed store, hash-verified

108// This is a noop for read transactions,
109// already aborted or commited transactions.
110func (txn *Txn) Abort() {
111 // Noop for a read transaction
112 if !txn.write {
113 return
114 }
115
116 // Check if already aborted or committed
117 if txn.rootTxn == nil {
118 return
119 }
120
121 // Clear the txn
122 txn.rootTxn = nil
123 txn.modified = nil
124 txn.changes = nil
125
126 // Release the writer lock since this is invalid
127 txn.db.writer.Unlock()
128}
129
130// Commit is used to finalize this transaction.
131// This is a noop for read transactions,

Callers 8

TestTxn_Read_AbortCommitFunction · 0.80
TestTxn_Defer_AbortFunction · 0.80
TestTxn_LowerBoundFunction · 0.80
TestTxn_ChangesFunction · 0.80
TestTxn_AbortFunction · 0.80

Calls

no outgoing calls

Tested by 8

TestTxn_Read_AbortCommitFunction · 0.64
TestTxn_Defer_AbortFunction · 0.64
TestTxn_LowerBoundFunction · 0.64
TestTxn_ChangesFunction · 0.64
TestTxn_AbortFunction · 0.64