Class: Grumlin::Transaction
- Inherits:
-
Object
- Object
- Grumlin::Transaction
- Defined in:
- lib/grumlin/transaction.rb
Direct Known Subclasses
Constant Summary collapse
- COMMIT =
Grumlin::Repository.new.g.step(:tx, :commit)
- ROLLBACK =
Grumlin::Repository.new.g.step(:tx, :rollback)
Instance Attribute Summary collapse
-
#pool ⇒ Object
readonly
Returns the value of attribute pool.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #begin ⇒ Object
- #commit ⇒ Object
-
#initialize(traversal_start_class, pool:, middlewares:) ⇒ Transaction
constructor
A new instance of Transaction.
- #rollback ⇒ Object
Constructor Details
#initialize(traversal_start_class, pool:, middlewares:) ⇒ Transaction
Returns a new instance of Transaction.
9 10 11 12 13 14 |
# File 'lib/grumlin/transaction.rb', line 9 def initialize(traversal_start_class, pool:, middlewares:) @traversal_start_class = traversal_start_class @pool = pool @session_id = SecureRandom.uuid @middlewares = middlewares end |
Instance Attribute Details
#pool ⇒ Object (readonly)
Returns the value of attribute pool.
4 5 6 |
# File 'lib/grumlin/transaction.rb', line 4 def pool @pool end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
4 5 6 |
# File 'lib/grumlin/transaction.rb', line 4 def session_id @session_id end |
Instance Method Details
#begin ⇒ Object
16 17 18 |
# File 'lib/grumlin/transaction.rb', line 16 def begin @traversal_start_class.new(session_id: @session_id, pool: @pool) end |
#commit ⇒ Object
20 21 22 |
# File 'lib/grumlin/transaction.rb', line 20 def commit finalize(COMMIT) end |
#rollback ⇒ Object
24 25 26 |
# File 'lib/grumlin/transaction.rb', line 24 def rollback finalize(ROLLBACK) end |