Class: Zold::SyncWallets
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Zold::SyncWallets
- Defined in:
- lib/zold/sync_wallets.rb
Overview
Synchronized collection of wallets
Instance Method Summary collapse
- #acq(id, exclusive: false) ⇒ Object
-
#initialize(wallets, log: Loog::NULL, dir: wallets.path) ⇒ SyncWallets
constructor
A new instance of SyncWallets.
Constructor Details
#initialize(wallets, log: Loog::NULL, dir: wallets.path) ⇒ SyncWallets
Returns a new instance of SyncWallets.
20 21 22 23 24 25 |
# File 'lib/zold/sync_wallets.rb', line 20 def initialize(wallets, log: Loog::NULL, dir: wallets.path) @wallets = wallets @log = log @dir = dir super(wallets) end |
Instance Method Details
#acq(id, exclusive: false) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/zold/sync_wallets.rb', line 27 def acq(id, exclusive: false) @wallets.acq(id, exclusive: exclusive) do |wallet| Futex.new(wallet.path, log: @log, lock: File.join(@dir, "#{id}.lock")).open(exclusive) do yield wallet end end end |