l.s.d.s.S3StorageDriver(StorageDriver) : class documentation

Part of libcloud.storage.drivers.s3 View Source View In Hierarchy

Known subclasses: libcloud.storage.drivers.google_storage.GoogleStorageDriver, libcloud.storage.drivers.s3.S3APNEStorageDriver, libcloud.storage.drivers.s3.S3APSEStorageDriver, libcloud.storage.drivers.s3.S3EUWestStorageDriver, libcloud.storage.drivers.s3.S3USWestOregonStorageDriver, libcloud.storage.drivers.s3.S3USWestStorageDriver

No class docstring
Method iterate_containers Return a generator of containers for the given account
Method iterate_container_objects Return a generator of objects for the given container.
Method get_container Return a container instance.
Method get_object Return an object instance.
Method create_container Create a new container.
Method delete_container Delete a container.
Method download_object Download an object to the specified destination path.
Method download_object_as_stream Return a generator which yields object data.
Method upload_object @inherits: L{StorageDriver.upload_object}
Method upload_object_via_stream @inherits: L{StorageDriver.upload_object_via_stream}
Method delete_object Delete an object.
Method ex_iterate_multipart_uploads Extension method for listing all in-progress S3 multipart uploads.
Method ex_cleanup_all_multipart_uploads Extension method for removing all partially completed S3 multipart uploads.
Method _get_container_path Return a container path
Method _get_object_path Return an object's CDN path.
Method _upload_multipart Callback invoked for uploading data to S3 using Amazon's multipart upload mechanism
Method _upload_from_iterator Uploads data from an interator in fixed sized chunks to S3
Method _commit_multipart Makes a final commit of the data.
Method _abort_multipart Aborts an already initiated multipart upload
Method _clean_object_name Undocumented
Method _put_object Undocumented
Method _to_containers Undocumented
Method _to_objs Undocumented
Method _to_container Undocumented
Method _headers_to_object Undocumented
Method _to_obj Undocumented

Inherited from StorageDriver:

Method __init__ @param key: API key or username to be used (required) @type key: C{str}
Method list_containers Return a list of containers.
Method list_container_objects Return a list of objects for the given container.
Method get_container_cdn_url Return a container CDN URL.
Method get_object_cdn_url Return a object CDN URL.
Method enable_container_cdn Enable container CDN.
Method enable_object_cdn Enable object CDN.
Method _get_object Call passed callback and start transfer of the object'
Method _save_object Save object to the provided path.
Method _upload_object Helper function for setting common request headers and calling the passed in callback which uploads an object.
Method _upload_data Upload data stored in a string.
Method _stream_data Stream a data over an http connection.
Method _upload_file Upload a file to the server.
Method _get_hash_function Return instantiated hash function for the hash type supported by the provider.

Inherited from BaseDriver (via StorageDriver):

Method _ex_connection_class_kwargs Return extra connection keyword arguments which are passed to the Connection class constructor.
def iterate_containers(self): (source)
Return a generator of containers for the given account

@return: A generator of Container instances.
@rtype: C{generator} of L{Container}
def iterate_container_objects(self, container): (source)
Return a generator of objects for the given container.

@param container: Container instance
@type container: L{Container}

@return: A generator of Object instances.
@rtype: C{generator} of L{Object}
def get_container(self, container_name): (source)
Return a container instance.

@param container_name: Container name.
@type container_name: C{str}

@return: L{Container} instance.
@rtype: L{Container}
def get_object(self, container_name, object_name): (source)
Return an object instance.

@param container_name: Container name.
@type  container_name: C{str}

@param object_name: Object name.
@type  object_name: C{str}

@return: L{Object} instance.
@rtype: L{Object}
def _get_container_path(self, container): (source)
Return a container path

@param container: Container instance
@type  container: L{Container}

@return: A path for this container.
@rtype: C{str}
def _get_object_path(self, container, object_name): (source)
Return an object's CDN path.

@param container: Container instance
@type  container: L{Container}

@param object_name: Object name
@type  object_name: L{str}

@return: A  path for this object.
@rtype: C{str}
def create_container(self, container_name): (source)
Create a new container.

@type container_name: C{str}
@param container_name: Container name.

@return: C{Container} instance on success.
@rtype: L{Container}
def delete_container(self, container): (source)
Delete a container.

@type container: L{Container}
@param container: Container instance

@return: True on success, False otherwise.
@rtype: C{bool}
def download_object(self, obj, destination_path, overwrite_existing=False, delete_on_failure=True): (source)
Download an object to the specified destination path.

@param obj: Object instance.
@type obj: L{Object}

@param destination_path: Full path to a file or a directory where the
                        incoming file will be saved.
@type destination_path: C{str}

@param overwrite_existing: True to overwrite an existing file,
    defaults to False.
@type overwrite_existing: C{bool}

@param delete_on_failure: True to delete a partially downloaded file if
the download was not successful (hash mismatch / file size).
@type delete_on_failure: C{bool}

@return: True if an object has been successfully downloaded, False
otherwise.
@rtype: C{bool}
def download_object_as_stream(self, obj, chunk_size=None): (source)
Return a generator which yields object data.

@param obj: Object instance
@type obj: L{Object}

@param chunk_size: Optional chunk size (in bytes).
@type chunk_size: C{int}

@rtype: C{object}
def upload_object(self, file_path, container, object_name, extra=None, verify_hash=True, ex_storage_class=None): (source)
@inherits: L{StorageDriver.upload_object}

@param ex_storage_class: Storage class
@type ex_storage_class: C{str}
def _upload_multipart(self, response, data, iterator, container, object_name, calculate_hash=True): (source)
Callback invoked for uploading data to S3 using Amazon's
multipart upload mechanism

@param response: Response object from the initial POST request
@type response: L{S3RawResponse}

@param data: Any data from the initial POST request
@type data: C{str}

@param iterator: The generator for fetching the upload data
@type iterator: C{generator}

@param container: The container owning the object to which data is
    being uploaded
@type container: L{Container}

@param object_name: The name of the object to which we are uploading
@type object_name: C{str}

@keyword calculate_hash: Indicates if we must calculate the data hash
@type calculate_hash: C{bool}

@return: A tuple of (status, checksum, bytes transferred)
@rtype: C{tuple}
def _upload_from_iterator(self, iterator, object_path, upload_id, calculate_hash=True): (source)
Uploads data from an interator in fixed sized chunks to S3

@param iterator: The generator for fetching the upload data
@type iterator: C{generator}

@param object_path: The path of the object to which we are uploading
@type object_name: C{str}

@param upload_id: The upload id allocated for this multipart upload
@type upload_id: C{str}

@keyword calculate_hash: Indicates if we must calculate the data hash
@type calculate_hash: C{bool}

@return: A tuple of (chunk info, checksum, bytes transferred)
@rtype: C{tuple}
def _commit_multipart(self, object_path, upload_id, chunks): (source)
Makes a final commit of the data.

@param object_path: Server side object path.
@type object_path: C{str}

@param upload_id: ID of the multipart upload.
@type upload_id: C{str}

@param upload_id: A list of (chunk_number, chunk_hash) tuples.
@type upload_id: C{list}
def _abort_multipart(self, object_path, upload_id): (source)
Aborts an already initiated multipart upload

@param object_path: Server side object path.
@type object_path: C{str}

@param upload_id: ID of the multipart upload.
@type upload_id: C{str}
def upload_object_via_stream(self, iterator, container, object_name, extra=None, ex_storage_class=None): (source)
@inherits: L{StorageDriver.upload_object_via_stream}

@param ex_storage_class: Storage class
@type ex_storage_class: C{str}
def delete_object(self, obj): (source)
Delete an object.

@type obj: L{Object}
@param obj: Object instance.

@return: C{bool} True on success.
@rtype: C{bool}
def ex_iterate_multipart_uploads(self, container, prefix=None, delimiter=None): (source)
Extension method for listing all in-progress S3 multipart uploads.

Each multipart upload which has not been committed or aborted is
considered in-progress.

@param container: The container holding the uploads
@type container: L{Container}

@keyword prefix: Print only uploads of objects with this prefix
@type prefix: C{str}

@keyword delimiter: The object/key names are grouped based on
    being split by this delimiter
@type delimiter: C{str}

@return: A generator of S3MultipartUpload instances.
@rtype: C{generator} of L{S3MultipartUpload}
def ex_cleanup_all_multipart_uploads(self, container, prefix=None): (source)
Extension method for removing all partially completed S3 multipart
uploads.

@param container: The container holding the uploads
@type container: L{Container}

@keyword prefix: Delete only uploads of objects with this prefix
@type prefix: C{str}
def _clean_object_name(self, name): (source)
Undocumented
def _put_object(self, container, object_name, upload_func, upload_func_kwargs, method='PUT', query_args=None, extra=None, file_path=None, iterator=None, verify_hash=True, storage_class=None): (source)
Undocumented
def _to_containers(self, obj, xpath): (source)
Undocumented
def _to_objs(self, obj, xpath, container): (source)
Undocumented
def _to_container(self, element): (source)
Undocumented
def _headers_to_object(self, object_name, container, headers): (source)
Undocumented
def _to_obj(self, element, container): (source)
Undocumented
API Documentation for libcloud, generated by pydoctor at 2013-07-01 17:02:02.