Class: Yobi::CancellableProxy
- Inherits:
-
Object
- Object
- Yobi::CancellableProxy
- Defined in:
- lib/yobi/cancellable_proxy.rb,
sig/yobi.rbs
Overview
Returned by Repository#with_cancellation. Exposes only the six long-running methods a Yobi::Cancellation token can stop; every other Repository method (#snapshots, #mount, #init, ...) is unreachable here.
token reaches the repository via a thread-local, set only for the
duration of each call and only on the calling thread.
Instance Method Summary collapse
- #backup ⇒ Object
- #check ⇒ Object
- #copy ⇒ Object
- #forget ⇒ Object
-
#initialize(repository, token) ⇒ CancellableProxy
constructor
A new instance of CancellableProxy.
- #prune ⇒ Object
- #restore ⇒ Object
Constructor Details
#initialize(repository, token) ⇒ CancellableProxy
9 10 11 12 |
# File 'lib/yobi/cancellable_proxy.rb', line 9 def initialize(repository, token) @repository = repository @token = token end |
Instance Method Details
#backup ⇒ Object
14 15 16 |
# File 'lib/yobi/cancellable_proxy.rb', line 14 def backup(...) with_token { @repository.backup(...) } end |
#check ⇒ Object
22 23 24 |
# File 'lib/yobi/cancellable_proxy.rb', line 22 def check(...) with_token { @repository.check(...) } end |
#copy ⇒ Object
34 35 36 |
# File 'lib/yobi/cancellable_proxy.rb', line 34 def copy(...) with_token { @repository.copy(...) } end |
#forget ⇒ Object
30 31 32 |
# File 'lib/yobi/cancellable_proxy.rb', line 30 def forget(...) with_token { @repository.forget(...) } end |
#prune ⇒ Object
26 27 28 |
# File 'lib/yobi/cancellable_proxy.rb', line 26 def prune(...) with_token { @repository.prune(...) } end |
#restore ⇒ Object
18 19 20 |
# File 'lib/yobi/cancellable_proxy.rb', line 18 def restore(...) with_token { @repository.restore(...) } end |