Sha256: 78fa2ec0cade174351f0c1bebb5bac500afa84d6e7c917d788a06cf9dea45fc4
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true module Grumlin class Transaction attr_reader :session_id include Console COMMIT = Grumlin::Repository.new.g.step(:tx, :commit) ROLLBACK = Grumlin::Repository.new.g.step(:tx, :rollback) def initialize(traversal_start_class, pool:, middlewares:) @traversal_start_class = traversal_start_class @pool = pool @session_id = SecureRandom.uuid @middlewares = middlewares end def begin @traversal_start_class.new(session_id: @session_id) end def commit finalize(COMMIT) end def rollback finalize(ROLLBACK) end private def finalize(step) @middlewares.call(traversal: step, need_results: false, session_id: @session_id, pool: @pool) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grumlin-0.23.0 | lib/grumlin/transaction.rb |