deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] Minor fixes/typos for buckets/blobs brought over into modular Deltacloud
Date Fri, 25 May 2012 11:05:56 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/collections/buckets.rb       |    5 +++--
 .../lib/deltacloud/helpers/blob_stream_helper.rb   |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/server/lib/deltacloud/collections/buckets.rb b/server/lib/deltacloud/collections/buckets.rb
index 16f3f8f..ba5af1e 100644
--- a/server/lib/deltacloud/collections/buckets.rb
+++ b/server/lib/deltacloud/collections/buckets.rb
@@ -159,6 +159,7 @@ module Deltacloud::Collections
             end
           end
         end
+
         action :metadata, :http_method => :head, :with_capability => :blob_metadata
do
           control do
             @blob_id = params[:blob]
@@ -200,12 +201,12 @@ module Deltacloud::Collections
         action :content, :http_method => :get, :with_capability => :blob do
           description "Download blob content"
           control do
-            @blob = driver.blob(credentials, { :id => params[:blob], 'bucket' => params[:bucket]})
+            @blob = driver.blob(credentials, { :id => params[:blob_id], 'bucket' =>
params[:id]})
             if @blob
               params['content_length'] = @blob.content_length
               params['content_type'] = @blob.content_type
               params['content_disposition'] = "attachment; filename=#{@blob.id}"
-              BlobStream.call(env, credentials, params)
+              BlobStream.call(self, credentials, params)
             else
               report_error(404)
             end
diff --git a/server/lib/deltacloud/helpers/blob_stream_helper.rb b/server/lib/deltacloud/helpers/blob_stream_helper.rb
index 3830c60..08cafe2 100644
--- a/server/lib/deltacloud/helpers/blob_stream_helper.rb
+++ b/server/lib/deltacloud/helpers/blob_stream_helper.rb
@@ -23,20 +23,20 @@ begin
   #--
   class BlobStream
     AsyncResponse = [-1, {}, []].freeze
-    def self.call(env, credentials, params)
-      body = DeferrableBody.new
+    def self.call(context, 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, {
+      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.
-      driver.blob_data(credentials, params[:bucket], params[:blob], params) {|chunk| body.call
["#{chunk}"]} #close blob_data block
+      context.driver.blob_data(credentials, params[:id], params[:blob_id], params) {|chunk|
body.call ["#{chunk}"]} #close blob_data block
       body.succeed
       AsyncResponse # Tell Thin to not close connection & work other requests
     end
-- 
1.7.6.5


Mime
View raw message