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: Log::NULL, dir: wallets.path) ⇒ SyncWallets
constructor
A new instance of SyncWallets.
Constructor Details
#initialize(wallets, log: Log::NULL, dir: wallets.path) ⇒ SyncWallets
Returns a new instance of SyncWallets.
37 38 39 40 41 42 |
# File 'lib/zold/sync_wallets.rb', line 37 def initialize(wallets, log: Log::NULL, dir: wallets.path) @wallets = wallets @log = log @dir = dir super(wallets) end |
Instance Method Details
#acq(id, exclusive: false) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/zold/sync_wallets.rb', line 44 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 |