Module: Marloss::InstanceMethods
- Defined in:
- lib/marloss.rb
Instance Method Summary collapse
- #marloss_locker(name) ⇒ Object
- #marloss_store ⇒ Object
- #with_marloss_locker(name, opts = {}) ⇒ Object
Instance Method Details
#marloss_locker(name) ⇒ Object
48 49 50 |
# File 'lib/marloss.rb', line 48 def marloss_locker(name) Locker.new(marloss_store, name) end |
#marloss_store ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/marloss.rb', line 36 def marloss_store @marloss_store ||= begin table = [:table] hash_key = [:hash_key] = .reject do |k, _| %i[table hash_key].include?(k) end Store.new(table, hash_key, ) end end |
#with_marloss_locker(name, opts = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/marloss.rb', line 52 def with_marloss_locker(name, opts = {}) has_lock = false locker = marloss_locker(name) locker.wait_until_lock_obtained(opts) has_lock = true yield(locker) ensure locker.release_lock if has_lock end |