Class: Pantry::Communication::FileService::UploadInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/pantry/communication/file_service/file_progress.rb

Overview

Informational object for keeping track of file upload progress and important information.

Direct Known Subclasses

ReceivingFile, SendingFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUploadInfo

Returns a new instance of UploadInfo.



15
16
17
# File 'lib/pantry/communication/file_service/file_progress.rb', line 15

def initialize
  @finish_future = Celluloid::Future.new
end

Instance Attribute Details

#file_uuidObject

The file session identity from the Receiver



13
14
15
# File 'lib/pantry/communication/file_service/file_progress.rb', line 13

def file_uuid
  @file_uuid
end

#receiver_uuidObject

Identity of the Receiver we’re sending a file to



10
11
12
# File 'lib/pantry/communication/file_service/file_progress.rb', line 10

def receiver_uuid
  @receiver_uuid
end

Instance Method Details

#finished!Object



24
25
26
# File 'lib/pantry/communication/file_service/file_progress.rb', line 24

def finished!
  @finish_future.signal(OpenStruct.new(:value => self))
end

#wait_for_finish(timeout = nil) ⇒ Object

Block and wait for the file upload to finish



20
21
22
# File 'lib/pantry/communication/file_service/file_progress.rb', line 20

def wait_for_finish(timeout = nil)
  @finish_future.value(timeout)
end