class ObjectFramework::Persistence::Transaction
Base lifecycle for read/write storage transactions. Adapters implement row access, commit, and storage cleanup. close rolls back an active transaction and is safe to repeat. Committed transactions cannot be reused.
Attributes
Public Class Methods
Source
# File lib/object_framework/persistence/transaction.rb, line 14 def initialize(mode:) raise ConfigurationError, "Invalid transaction mode" unless %i[read write].include?(mode) @mode, @state, @closed = mode, :active, false end
Public Instance Methods
Source
# File lib/object_framework/persistence/transaction.rb, line 25 def close return if @closed begin rollback if @state == :active ensure @closed = true close_storage end end
Source
# File lib/object_framework/persistence/transaction.rb, line 19 def rollback active! rollback_storage @state = :rolled_back end