Skip to content
Browse files

Rename stream_object_data to upload_object_via_stream

git-svn-id: https://svn.apache.org/repos/asf/incubator/libcloud/trunk@1081240 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 429d478 commit 7e3a91ef6b10e73592b7aaf233c49cd765695d04 @pquerna pquerna committed Mar 14, 2011
View
8 libcloud/storage/base.py
@@ -112,8 +112,8 @@ def get_object(self, object_name):
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 @@ def upload_object(self, file_path, container, object_name, extra=None,
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 @@ def stream_object_data(self, iterator, container, object_name, extra=None):
@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):
"""
View
2 libcloud/storage/drivers/cloudfiles.py
@@ -317,7 +317,7 @@ def upload_object(self, file_path, container, object_name, extra=None,
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)
View
14 libcloud/storage/drivers/dummy.py
@@ -86,7 +86,7 @@ def get_meta_data(self):
{'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 @@ def get_object(self, container_name, object_name):
>>> 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 @@ def delete_container(self, container):
>>> 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 @@ def object_as_stream(self, obj, chunk_size=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={})
>>> stream = container.object_as_stream(obj)
>>> stream #doctest: +ELLIPSIS
<closed file '<uninitialized file>', mode '<uninitialized file>' at 0x...>
@@ -285,11 +285,11 @@ def upload_object(self, file_path, container, object_name, extra=None,
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 @@ def delete_object(self, obj):
"""
>>> 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)
View
6 test/storage/test_cloudfiles.py
@@ -303,7 +303,7 @@ def dummy_content_type(name):
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 @@ def dummy_content_type(name):
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 @@ def _v1_MossoCloudFS_foo_bar_container_foo_bar_object_INVALID_SIZE(self, method,
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])

0 comments on commit 7e3a91e

Please sign in to comment.
Something went wrong with that request. Please try again.