You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/05/25 17:34:01 UTC
git commit: Minor fixes/typos for buckets/blobs brought over into
modular Deltacloud
Updated Branches:
refs/heads/master 3952b80d4 -> d88ee48b1
Minor fixes/typos for buckets/blobs brought over into modular Deltacloud
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/d88ee48b
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/d88ee48b
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/d88ee48b
Branch: refs/heads/master
Commit: d88ee48b17d69e11cdc458f919d1d1695f5953c7
Parents: 3952b80
Author: marios <ma...@redhat.com>
Authored: Fri May 25 14:04:30 2012 +0300
Committer: marios <ma...@redhat.com>
Committed: Fri May 25 18:32:37 2012 +0300
----------------------------------------------------------------------
server/lib/deltacloud/collections/buckets.rb | 5 +++--
.../lib/deltacloud/helpers/blob_stream_helper.rb | 8 ++++----
2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d88ee48b/server/lib/deltacloud/collections/buckets.rb
----------------------------------------------------------------------
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
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d88ee48b/server/lib/deltacloud/helpers/blob_stream_helper.rb
----------------------------------------------------------------------
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