(** Transaction operations with phantom types for mode safety *) type 'mode t = { mutable state : Types.txn_state } let root (_ : 'mode t) : ('mode Bucket.t, Error.t) result = Ok (Obj.magic ()) let state txn = txn.state let commit txn = txn.state <- Types.Committed; Ok () ;; let rollback txn = txn.state <- Types.Rolled_back