incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1067266 - in /incubator/deltacloud/trunk/server: lib/deltacloud/drivers/azure/ lib/deltacloud/drivers/ec2/ lib/deltacloud/drivers/rackspace/ lib/deltacloud/helpers/ views/buckets/
Date Fri, 04 Feb 2011 19:31:55 GMT
Author: marios
Date: Fri Feb  4 19:31:55 2011
New Revision: 1067266

URL: http://svn.apache.org/viewvc?rev=1067266&view=rev
Log:
 Reworks GET BUCKET so that only get a full listing of blobs if a specific bucket is requested
(and just list of bucket names otherwise) - azure, ec2, cloudfiles

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/azure/azure_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
    incubator/deltacloud/trunk/server/views/buckets/index.html.haml
    incubator/deltacloud/trunk/server/views/buckets/index.xml.haml

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/azure/azure_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/azure/azure_driver.rb?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/azure/azure_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/azure/azure_driver.rb Fri Feb
 4 19:31:55 2011
@@ -36,10 +36,15 @@ class AzureDriver < Deltacloud::BaseDriv
     buckets = []
     azure_connect(credentials)
     safely do
-      WAZ::Blobs::Container.list.each do |waz_container|
-        buckets << convert_container(waz_container)
-      end
-    end
+      unless (opts[:id].nil?)
+        waz_bucket =  WAZ::Blobs::Container.find(opts[:id])
+        buckets << convert_container(waz_bucket)
+      else
+        WAZ::Blobs::Container.list.each do |waz_container|
+          buckets << Bucket.new({:id =>waz_container.name, :name => waz_container.name})
+        end #container.list.each
+      end #unless
+    end #safely
     buckets = filter_on(buckets, :id, opts)
   end
 

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Fri Feb  4
19:31:55 2011
@@ -323,16 +323,20 @@ module Deltacloud
           end
         end
 
-
         def buckets(credentials, opts={})
           buckets = []
           safely do
             s3_client = new_client(credentials, :s3)
-            bucket_list = s3_client.buckets
-            bucket_list.each do |current|
-              buckets << convert_bucket(current)
-            end
-          end
+            unless (opts[:id].nil?)
+              bucket = s3_client.bucket(opts[:id])
+              buckets << convert_bucket(bucket)
+            else
+              bucket_list = s3_client.buckets
+              bucket_list.each do |current|
+                buckets << Bucket.new({:name => current.name, :id => current.name})
+              end #bucket_list.each
+            end #if
+          end #safely
           filter_on(buckets, :id, opts)
         end
 
@@ -509,7 +513,7 @@ module Deltacloud
                     when :ec2 then Aws::Ec2
                     when :s3 then Aws::S3
                   end
-          klass.new(credentials.user, credentials.password, :server => endpoint_for_service(type))
+          klass.new(credentials.user, credentials.password, {:server => endpoint_for_service(type),
:connection_mode => :per_thread})
         end
 
         DEFAULT_SERVICE_ENDPOINTS = {
@@ -580,7 +584,7 @@ module Deltacloud
           Bucket.new(
             :id => s3_bucket.name,
             :name => s3_bucket.name,
-            :size => s3_bucket.keys.length,
+            :size => blob_list.length,
             :blob_list => blob_list
           )
         end

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
Fri Feb  4 19:31:55 2011
@@ -170,13 +170,16 @@ class RackspaceDriver < Deltacloud::Base
     bucket_list = []
     cf = cloudfiles_client(credentials)
     safely do
-      cf.containers.each do |container_name|
-        current = cf.container(container_name)
-        bucket_list << convert_container(current)
-      end #containers.each
+      unless (opts[:id].nil?)
+        bucket = cf.container(opts[:id])
+        bucket_list << convert_container(bucket)
+      else
+        cf.containers.each do |container_name|
+          bucket_list << Bucket.new({:id => container_name, :name => container_name})
+        end #containers.each
+      end #unless
     end #safely
-    bucket_list = filter_on(bucket_list, :id, opts)
-    bucket_list
+    filter_on(bucket_list, :id, opts)
   end
 
 #--

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb Fri Feb
 4 19:31:55 2011
@@ -76,7 +76,7 @@ module ApplicationHelper
       filter.merge!(:architecture => params[:architecture]) if params[:architecture]
       filter.merge!(:owner_id => params[:owner_id]) if params[:owner_id]
       filter.merge!(:state => params[:state]) if params[:state]
-      filter = nil if filter.keys.size.eql?(0)
+      filter = {} if filter.keys.size.eql?(0)
       singular = model.to_s.singularize.to_sym
       @benchmark = Benchmark.measure do
         @elements = driver.send(model.to_sym, credentials, filter)

Modified: incubator/deltacloud/trunk/server/views/buckets/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/index.html.haml?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/index.html.haml Fri Feb  4 19:31:55 2011
@@ -11,11 +11,6 @@
         ID
       %th
         Name
-      %th
-        Size
-      %th
-        Blob List
-      %th
 
   %tbody
     - @buckets.each do |bucket|
@@ -25,10 +20,4 @@
         %td
           = bucket.name
         %td
-          = bucket.size
-        %td
-          -bucket.blob_list.each do |blob|
-            = blob
-        %td
-          -if bucket.size == 0
-            =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
+          =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete

Modified: incubator/deltacloud/trunk/server/views/buckets/index.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/index.xml.haml?rev=1067266&r1=1067265&r2=1067266&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/index.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/index.xml.haml Fri Feb  4 19:31:55 2011
@@ -3,8 +3,6 @@
   - @elements.each do |bucket|
     %bucket{:href => bucket_url(bucket.id), :id => bucket.id}
       - bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
-        - unless attribute == :blob_list
-          - haml_tag("#{attribute}".tr('-', '_'), :<) do
-            - haml_concat bucket.send(attribute)
-      - bucket.blob_list.each do |blb|
-        %blob{ :id => blb, :href => bucket_url(bucket.id) +"/#{blb}"}
+        - haml_tag("#{attribute}".tr('-', '_'), :<) do
+          - haml_concat bucket.send(attribute)
+



Mime
View raw message