Class: Aspera::Agent::Base
- Inherits:
-
Object
- Object
- Aspera::Agent::Base
- Defined in:
- lib/aspera/agent/base.rb
Overview
Base class for transfer agents Transfer agents provide methods:
start_transfer: take a transfer spec and start a transfer asynchronouslywait_for_transfers_completion: waits for all transfer sessions to finishnotify_progress: called back by transfer agent to notify transfer progressself.transfer_status: (optional) re-query a previously started transfer by id
Class Method Summary collapse
-
.transfer_status(_transfer_id, _agent_params) ⇒ Hash?
Re-query the status of a transfer that was started asynchronously.
Instance Method Summary collapse
-
#last_job_id ⇒ String?
Return the job_id of the last transfer submitted by this agent.
-
#wait_for_completion ⇒ Transfer::Result::Success, Transfer::Result::Error
Wait for all sessions to terminate and return a typed Transfer::Result.
Class Method Details
.transfer_status(_transfer_id, _agent_params) ⇒ Hash?
Re-query the status of a transfer that was started asynchronously. Override in agents that support live status queries (desktop, node, connect, transferd).
20 21 22 |
# File 'lib/aspera/agent/base.rb', line 20 def transfer_status(_transfer_id, _agent_params) nil end |
Instance Method Details
#last_job_id ⇒ String?
Return the job_id of the last transfer submitted by this agent. In-process agents (direct, httpgw) override this to expose their internal job id. Remote-daemon agents do not need to override it: TransferAgent generates a UUID itself.
40 41 42 |
# File 'lib/aspera/agent/base.rb', line 40 def last_job_id nil end |
#wait_for_completion ⇒ Transfer::Result::Success, Transfer::Result::Error
Wait for all sessions to terminate and return a typed Transfer::Result.
27 28 29 30 31 32 33 34 |
# File 'lib/aspera/agent/base.rb', line 27 def wait_for_completion statuses = wait_for_transfers_completion @progress&.reset Aspera.assert_type(statuses, Array) Aspera.assert(statuses.none? { |i| !i.eql?(:success) && !i.is_a?(StandardError) }) { "bad statuses content: #{statuses}" } errors = statuses.reject { |i| i.eql?(:success) } return errors.empty? ? Transfer::Result.success : Transfer::Result.error(errors.first) end |