Parent

Methods

Class/Module Index [+]

Quicksearch

BlobStream

EventMachine isn't available, disable blob streaming

Constants

AsyncResponse

Public Class Methods

call(env, credentials, params) click to toggle source
# File lib/deltacloud/helpers/blob_stream.rb, line 25
def self.call(env, credentials, params)
  body = DeferrableBody.new
  #Get the headers out asap. Don't specify a content-type let
  #the client guess and if they can't they SHOULD default to
  #'application/octet-stream' anyway as per:
  #http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
  EM.next_tick { 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.
  driver.blob_data(credentials, params[:bucket], params[:blob], params) {|chunk| body.call ["#{chunk}"]} #close blob_data block
  body.succeed
  AsyncResponse # Tell Thin to not close connection & work other requests
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.