Class: Aspera::Plugins::Transferd::Client
- Inherits:
-
Object
- Object
- Aspera::Plugins::Transferd::Client
- Defined in:
- lib/aspera/plugins/transferd/client.rb
Overview
Calls to a running Transfer Daemon with plain Ruby arguments: builds the gRPC requests, returns the gRPC responses.
Used by code that must not know the generated gRPC classes (e.g. the emulator of the bundle node).
Class Method Summary collapse
-
.empty_message(name) ⇒ Google::Protobuf::AbstractMessage
Empty gRPC message, used as default when no message was received.
Instance Method Summary collapse
-
#initialize(stub) ⇒ Client
constructor
A new instance of Client.
-
#instance_info ⇒ Transferd::Api::InstanceInfoResponse
Information on the daemon.
- #modify(transfer_id, changes_json) ⇒ Transferd::Api::TransferModificationResponse
-
#start_with_monitor(transfer_spec_json) {|response| ... } ⇒ Object
Start a transfer and yield its events until the stream ends.
- #stop(transfer_id) ⇒ Transferd::Api::StopTransferResponse
Constructor Details
#initialize(stub) ⇒ Client
Returns a new instance of Client.
31 32 33 |
# File 'lib/aspera/plugins/transferd/client.rb', line 31 def initialize(stub) @stub = stub end |
Class Method Details
.empty_message(name) ⇒ Google::Protobuf::AbstractMessage
Empty gRPC message, used as default when no message was received
19 20 21 22 23 24 25 26 27 |
# File 'lib/aspera/plugins/transferd/client.rb', line 19 def (name) case name when :transfer_info then ::Transferd::Api::TransferInfo.new when :instance_info then ::Transferd::Api::InstanceInfo.new when :aspera_info then ::Transferd::Api::AsperaInfo.new when :license_info then ::Transferd::Api::LicenseInfo.new else Aspera.error_unexpected_value(name) end end |
Instance Method Details
#instance_info ⇒ Transferd::Api::InstanceInfoResponse
Returns Information on the daemon.
36 37 38 |
# File 'lib/aspera/plugins/transferd/client.rb', line 36 def instance_info @stub.get_info(::Transferd::Api::InstanceInfoRequest.new) end |
#modify(transfer_id, changes_json) ⇒ Transferd::Api::TransferModificationResponse
61 62 63 |
# File 'lib/aspera/plugins/transferd/client.rb', line 61 def modify(transfer_id, changes_json) @stub.modify_transfer(::Transferd::Api::TransferModificationRequest.new(transferId: transfer_id, transferSpec: changes_json)) end |
#start_with_monitor(transfer_spec_json) {|response| ... } ⇒ Object
Start a transfer and yield its events until the stream ends
43 44 45 46 47 48 49 50 |
# File 'lib/aspera/plugins/transferd/client.rb', line 43 def start_with_monitor(transfer_spec_json, &block) request = ::Transferd::Api::TransferRequest.new( transferType: ::Transferd::Api::TransferType::FILE_REGULAR, config: ::Transferd::Api::TransferConfig.new, transferSpec: transfer_spec_json ) @stub.start_transfer_with_monitor(request, &block) end |
#stop(transfer_id) ⇒ Transferd::Api::StopTransferResponse
54 55 56 |
# File 'lib/aspera/plugins/transferd/client.rb', line 54 def stop(transfer_id) @stub.stop_transfer(::Transferd::Api::StopTransferRequest.new(transferId: [transfer_id])) end |