aboutsummaryrefslogtreecommitdiff
path: root/src/dedo.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-25 14:01:52 -0300
committerEuAndreh <eu@euandre.org>2025-01-25 14:01:52 -0300
commitd116633b12cad8c4acdf78ad9aaf6bb395d3ef64 (patch)
tree39d65dcf46c7e61666525666a387db7b02158e5a /src/dedo.go
parentsrc/dedo.go: Remove public API for manually managing transactions (diff)
downloaddedo-d116633b12cad8c4acdf78ad9aaf6bb395d3ef64.tar.gz
dedo-d116633b12cad8c4acdf78ad9aaf6bb395d3ef64.tar.xz
src/dedo.go: Remove Tx.managed field
Diffstat (limited to 'src/dedo.go')
-rw-r--r--src/dedo.go13
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
}