diff options
Diffstat (limited to 'src/dedo.go')
-rw-r--r-- | src/dedo.go | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/dedo.go b/src/dedo.go index a96f8ef..8965712 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -274,7 +274,6 @@ type txid uint64 /// quickly grow. type Tx struct { writable bool - managed bool db *DB meta *meta root Bucket @@ -1996,14 +1995,9 @@ func (db *DB) Update(fn func(*Tx) error) error { } }() - // Mark as a managed tx so that the inner function cannot manually - // commit. - t.managed = true - // If an error is returned from the function then rollback and return // error. err = fn(t) - t.managed = false if err != nil { _ = t.rollback() return err @@ -2030,13 +2024,8 @@ func (db *DB) View(fn func(*Tx) error) error { } }() - // Mark as a managed tx so that the inner function cannot manually - // rollback. - t.managed = true - // If an error is returned from the function then pass it through. err = fn(t) - t.managed = false if err != nil { _ = t.rollback() return err @@ -3447,7 +3436,6 @@ func (tx *Tx) OnCommit(fn func()) { /// an error if a disk write error occurs, or if Tx.commiti() is called on a /// read-only transaction. func (tx *Tx) commit() error { - g.Assert(!tx.managed, "managed tx commit not allowed") if tx.db == nil { return ErrTxClosed } else if !tx.writable { @@ -3543,7 +3531,6 @@ func (tx *Tx) commit() error { /// Tx.rollback() closes the transaction and ignores all previous updates. /// Read-only transactions must be rolled back and not committed. func (tx *Tx) rollback() error { - g.Assert(!tx.managed, "managed tx rollback not allowed") if tx.db == nil { return ErrTxClosed } |