Class: Aspera::Agent::Httpgw
Instance Method Summary collapse
-
#initialize(url:, api_version: Api::Httpgw::API_V2, upload_chunk_size: 64_000, synchronous: false, **base_options) ⇒ Httpgw
constructor
A new instance of Httpgw.
-
#start_transfer(transfer_spec, token_regenerator: nil) ⇒ Object
Start FASP transfer based on transfer spec (hash table) note that this should be asynchronous, but it is not HTTP download only supports file list :reek:UnusedParameters token_regenerator.
-
#wait_for_transfers_completion ⇒ Object
Wait for completion of all jobs started.
Methods inherited from Base
agent_list, factory_create, #wait_for_completion
Constructor Details
#initialize(url:, api_version: Api::Httpgw::API_V2, upload_chunk_size: 64_000, synchronous: false, **base_options) ⇒ Httpgw
Returns a new instance of Httpgw.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/aspera/agent/httpgw.rb', line 12 def initialize( url:, api_version: Api::Httpgw::API_V2, upload_chunk_size: 64_000, synchronous: false, ** ) super(**) @gw_api = Api::Httpgw.new( # remove /v1 from end of user-provided GW url: we need the base url only url: url, api_version: api_version, upload_chunk_size: upload_chunk_size, synchronous: synchronous, notify_cb: ->(*pa, **ka){notify_progress(*pa, **ka)} ) end |
Instance Method Details
#start_transfer(transfer_spec, token_regenerator: nil) ⇒ Object
Start FASP transfer based on transfer spec (hash table) note that this should be asynchronous, but it is not HTTP download only supports file list :reek:UnusedParameters token_regenerator
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/aspera/agent/httpgw.rb', line 34 def start_transfer(transfer_spec, token_regenerator: nil) raise 'GW URL must be set' if @gw_api.nil? Aspera.assert_type(transfer_spec['paths'], Array){'paths'} Aspera.assert_type(transfer_spec['token'], String){'only token based transfer is supported in GW'} Log.log.debug{Log.dump(:user_spec, transfer_spec)} transfer_spec['authentication'] ||= 'token' case transfer_spec['direction'] when Transfer::Spec::DIRECTION_SEND @gw_api.upload(transfer_spec) when Transfer::Spec::DIRECTION_RECEIVE @gw_api.download(transfer_spec) else Aspera.error_unexpected_value(transfer_spec['direction']){'direction'} end end |
#wait_for_transfers_completion ⇒ Object
Wait for completion of all jobs started
51 52 53 54 |
# File 'lib/aspera/agent/httpgw.rb', line 51 def wait_for_transfers_completion # well ... transfer was done in "start" return [:success] end |