You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2011/03/14 01:28:57 UTC

svn commit: r1081240 - in /incubator/libcloud/trunk: libcloud/storage/base.py libcloud/storage/drivers/cloudfiles.py libcloud/storage/drivers/dummy.py test/storage/test_cloudfiles.py

Author: pquerna
Date: Mon Mar 14 00:28:56 2011
New Revision: 1081240

URL: http://svn.apache.org/viewvc?rev=1081240&view=rev
Log:
Rename stream_object_data to upload_object_via_stream

Modified:
    incubator/libcloud/trunk/libcloud/storage/base.py
    incubator/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
    incubator/libcloud/trunk/libcloud/storage/drivers/dummy.py
    incubator/libcloud/trunk/test/storage/test_cloudfiles.py

Modified: incubator/libcloud/trunk/libcloud/storage/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/base.py?rev=1081240&r1=1081239&r2=1081240&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/base.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/base.py Mon Mar 14 00:28:56 2011
@@ -112,8 +112,8 @@ class Container(object):
     def upload_object(self, file_path, object_name, extra=None, file_hash=None):
         return self.driver.upload_object(file_path, self, object_name, extra, file_hash)
 
-    def stream_object_data(self, iterator, object_name, extra=None):
-        return self.driver.stream_object_data(iterator, self, object_name, extra)
+    def upload_object_via_stream(self, iterator, object_name, extra=None):
+        return self.driver.upload_object_via_stream(iterator, self, object_name, extra)
 
     def download_object(self, obj, destination_path, overwrite_existing=False,
                         delete_on_failure=True):
@@ -277,7 +277,7 @@ class StorageDriver(object):
         raise NotImplementedError, \
             'upload_object not implemented for this driver'
 
-    def stream_object_data(self, iterator, container, object_name, extra=None):
+    def upload_object_via_stream(self, iterator, container, object_name, extra=None):
         """
         @type iterator: C{object}
         @param iterator: An object which implements the iterator interface.
@@ -292,7 +292,7 @@ class StorageDriver(object):
         @param extra: (optional) Extra attributes (driver specific).
         """
         raise NotImplementedError, \
-            'stream_object_data not implemented for this driver'
+            'upload_object_via_stream not implemented for this driver'
 
     def delete_object(self, obj):
         """

Modified: incubator/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py?rev=1081240&r1=1081239&r2=1081240&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py Mon Mar 14 00:28:56 2011
@@ -317,7 +317,7 @@ class CloudFilesStorageDriver(StorageDri
                                 upload_func=upload_func,
                                 upload_func_args=upload_func_args)
 
-    def stream_object_data(self, iterator, container, object_name, extra=None):
+    def upload_object_via_stream(self, iterator, container, object_name, extra=None):
         if isinstance(iterator, file):
             iterator = iter(iterator)
 

Modified: incubator/libcloud/trunk/libcloud/storage/drivers/dummy.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/drivers/dummy.py?rev=1081240&r1=1081239&r2=1081240&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/drivers/dummy.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/drivers/dummy.py Mon Mar 14 00:28:56 2011
@@ -86,7 +86,7 @@ class DummyStorageDriver(StorageDriver):
         {'object_count': 0, 'container_count': 0, 'bytes_used': 0}
         >>> container = driver.create_container(container_name='test container 1')
         >>> container = driver.create_container(container_name='test container 2')
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> driver.get_meta_data()
         {'object_count': 1, 'container_count': 2, 'bytes_used': 50}
         """
@@ -167,7 +167,7 @@ class DummyStorageDriver(StorageDriver):
         >>> driver.get_object('test container 1', 'unknown') #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ObjectDoesNotExistError:
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> obj
         <Object: name=test object, size=50, hash=None, provider=Dummy Storage Provider ...>
         """
@@ -219,7 +219,7 @@ class DummyStorageDriver(StorageDriver):
         >>> len(driver._containers)
         0
         >>> container = driver.create_container(container_name='test container 1') #doctest: +IGNORE_EXCEPTION_DETAIL
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> driver.delete_container(container=container) #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ContainerIsNotEmptyError:
@@ -252,7 +252,7 @@ class DummyStorageDriver(StorageDriver):
         """
         >>> driver = DummyStorageDriver('key', 'secret')
         >>> container = driver.create_container(container_name='test container 1') #doctest: +IGNORE_EXCEPTION_DETAIL
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> stream = container.object_as_stream(obj)
         >>> stream #doctest: +ELLIPSIS
         <closed file '<uninitialized file>', mode '<uninitialized file>' at 0x...>
@@ -285,11 +285,11 @@ class DummyStorageDriver(StorageDriver):
         return self._add_object(container=container, object_name=object_name,
                                 size=size, extra=extra)
 
-    def stream_object_data(self, iterator, container, object_name, extra=None):
+    def upload_object_via_stream(self, iterator, container, object_name, extra=None):
         """
         >>> driver = DummyStorageDriver('key', 'secret')
         >>> container = driver.create_container(container_name='test container 1') #doctest: +IGNORE_EXCEPTION_DETAIL
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> obj #doctest: +ELLIPSIS
         <Object: name=test object, size=50, ...>
         """
@@ -302,7 +302,7 @@ class DummyStorageDriver(StorageDriver):
         """
         >>> driver = DummyStorageDriver('key', 'secret')
         >>> container = driver.create_container(container_name='test container 1') #doctest: +IGNORE_EXCEPTION_DETAIL
-        >>> obj = container.stream_object_data(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
+        >>> obj = container.upload_object_via_stream(object_name='test object', iterator=DummyFileObject(5, 10), extra={})
         >>> obj #doctest: +ELLIPSIS
         <Object: name=test object, size=50, ...>
         >>> container.delete_object(obj=obj)

Modified: incubator/libcloud/trunk/test/storage/test_cloudfiles.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/storage/test_cloudfiles.py?rev=1081240&r1=1081239&r2=1081240&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/storage/test_cloudfiles.py (original)
+++ incubator/libcloud/trunk/test/storage/test_cloudfiles.py Mon Mar 14 00:28:56 2011
@@ -303,7 +303,7 @@ class CloudFilesTests(unittest.TestCase)
         finally:
             libcloud.utils.guess_file_mime_type = old_func
 
-    def test_stream_object_data(self):
+    def test_upload_object_via_stream(self):
         def dummy_content_type(name):
             return 'application/zip', None
 
@@ -314,7 +314,7 @@ class CloudFilesTests(unittest.TestCase)
         object_name = 'foo_test_stream_data'
         iterator = DummyIterator(data=['2', '3', '5'])
         try:
-            obj = self.driver.stream_object_data(container=container,
+            obj = self.driver.upload_object_via_stream(container=container,
                                                  object_name=object_name,
                                                  iterator=iterator)
         finally:
@@ -545,7 +545,7 @@ class CloudFilesMockRawResponse(MockRawR
         return (httplib.OK, body, self.base_headers, httplib.responses[httplib.OK])
 
     def _v1_MossoCloudFS_foo_bar_container_foo_test_stream_data(self, method, url, body, headers):
-        # test_stream_object_data_success
+        # test_upload_object_via_stream_success
         body = 'test'
         return (httplib.OK, body, self.base_headers, httplib.responses[httplib.OK])