Method: Pantry::Communication::FileService::ReceivingFile#initialize

Defined in:
lib/pantry/communication/file_service/file_progress.rb

#initialize(file_size, checksum, chunk_size, pipeline_size) ⇒ ReceivingFile

Returns a new instance of ReceivingFile.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/pantry/communication/file_service/file_progress.rb', line 80

def initialize(file_size, checksum, chunk_size, pipeline_size)
  super()
  @file_uuid = SecureRandom.uuid
  @file_size = file_size
  @checksum  = checksum

  @chunk_size    = chunk_size
  @pipeline_size = pipeline_size

  @uploaded_file = Tempfile.new(file_uuid)
  @uploaded_path = @uploaded_file.path

  @next_requested_file_offset = 0
  @current_pipeline_size      = 0

  @chunk_count      = (@file_size.to_f / @chunk_size.to_f).ceil
  @requested_chunks = 0
  @received_chunks  = 0
end