Part of libcloud.storage.drivers.local View Source View In Hierarchy
Implementation of local file-system based storage. This is helpful where the user would want to use the same code (using libcloud) and switch between cloud storage and local storage
Method | __init__ | @param key: API key or username to be used (required) @type key: C{str} |
Method | iterate_containers | Return a generator of containers. |
Method | iterate_container_objects | Returns a generator of objects for the given container. |
Method | get_container | Return a container instance. |
Method | get_container_cdn_url | Return a container CDN URL. |
Method | get_object | Return an object instance. |
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 | 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 | Upload an object currently located on a disk. |
Method | upload_object_via_stream | Upload an object using an iterator. |
Method | delete_object | Delete an object. |
Method | create_container | Create a new container. |
Method | delete_container | Delete a container. |
Method | _make_path | Create a path by checking if it already exists |
Method | _check_container_name | Check if the container name is valid |
Method | _make_container | Create a container instance |
Method | _make_object | Create an object instance |
Method | _get_objects | Recursively iterate through the file-system and return the object names |
Inherited from StorageDriver:
Method | list_containers | Return a list of containers. |
Method | list_container_objects | Return a list of objects for the given container. |
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. |
@param key: API key or username to be used (required) @type key: C{str} @param secret: Secret password to be used (required) @type secret: C{str} @param secure: Weither to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default. @type secure: C{bool} @param host: Override hostname used for connections. @type host: C{str} @param port: Override port used for connections. @type port: C{int} @param api_version: Optional API version. Only used by drivers which support multiple API versions. @type api_version: C{str} @rtype: C{None}
Create a path by checking if it already exists
Check if the container name is valid @param container_name: Container name @type container_name: C{str}
Create a container instance @param container_name: Container name. @type container_name: C{str} @return: Container instance. @rtype: L{Container}
Create an object instance @param container: Container. @type container: L{Container} @param object_name: Object name. @type object_name: C{str} @return: Object instance. @rtype: L{Object}
Return a generator of containers. @return: A generator of Container instances. @rtype: C{generator} of L{Container}
Recursively iterate through the file-system and return the object names
Returns 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}
Return a container instance. @param container_name: Container name. @type container_name: C{str} @return: L{Container} instance. @rtype: L{Container}
Return a container CDN URL. @param container: Container instance @type container: L{Container} @param check: Indicates if the path's existance must be checked @type check: C{bool} @return: A CDN URL for this container. @rtype: C{str}
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}
Return a object CDN URL. @param obj: Object instance @type obj: L{Object} @return: A CDN URL for this object. @rtype: C{str}
Enable container CDN. @param container: Container instance @type container: L{Container} @rtype: C{bool}
Enable object CDN. @param obj: Object instance @type obj: L{Object} @rtype: C{bool}
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}
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}
Upload an object currently located on a disk. @param file_path: Path to the object on disk. @type file_path: C{str} @param container: Destination container. @type container: L{Container} @param object_name: Object name. @type object_name: C{str} @param verify_hash: Verify hast @type verify_hash: C{bool} @param extra: (optional) Extra attributes (driver specific). @type extra: C{dict} @rtype: C{object}
Upload an object using an iterator. If a provider supports it, chunked transfer encoding is used and you don't need to know in advance the amount of data to be uploaded. Otherwise if a provider doesn't support it, iterator will be exhausted so a total size for data to be uploaded can be determined. Note: Exhausting the iterator means that the whole data must be buffered in memory which might result in memory exhausting when uploading a very large object. If a file is located on a disk you are advised to use upload_object function which uses fs.stat function to determine the file size and it doesn't need to buffer whole object in the memory. @type iterator: C{object} @param iterator: An object which implements the iterator interface. @type container: L{Container} @param container: Destination container. @type object_name: C{str} @param object_name: Object name. @type extra: C{dict} @param extra: (optional) Extra attributes (driver specific). Note: This dictionary must contain a 'content_type' key which represents a content type of the stored object. @rtype: C{object}
Delete an object. @type obj: L{Object} @param obj: Object instance. @return: C{bool} True on success. @rtype: C{bool}
Create a new container. @type container_name: C{str} @param container_name: Container name. @return: C{Container} instance on success. @rtype: L{Container}
Delete a container. @type container: L{Container} @param container: Container instance @return: True on success, False otherwise. @rtype: C{bool}