class BlobStream

EventMachine isn't available, disable blob streaming

Constants

AsyncResponse

Public Class Methods

call(context, credentials, params) click to toggle source
# File lib/deltacloud/helpers/blob_stream_helper.rb, line 26
def self.call(context, credentials, params)
 body = DeferrableBody.new
  #Get the headers out asap.
  EM.next_tick { context.env['async.callback'].call [200, {
    'Content-Type' => "#{params['content_type']}",
    'Content-Disposition' => params["content_disposition"],
    'Content-Length' => "#{params['content_length']}"}, body]
  }
  #call the driver from here. the driver method yields for every chunk
  #of blob it receives. Then use body.call to write that chunk as received.
  context.driver.blob_data(credentials, params[:id], params[:blob_id], params) {|chunk| body.call [chunk]} #close blob_data block
  body.succeed
  AsyncResponse.dup # Tell Thin to not close connection & work other requests
end