From d116633b12cad8c4acdf78ad9aaf6bb395d3ef64 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 25 Jan 2025 14:01:52 -0300 Subject: src/dedo.go: Remove Tx.managed field --- src/dedo.go | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src') 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 } -- cgit v1.2.3