” OpenStack Swift Python client binding.
Cloud Files client library used internally
Bases: object
Convenience class to make requests that will also retry the request
Parameters: |
|
---|
Wrapper for delete_container()
Wrapper for delete_object()
Wrapper for get_account()
Wrapper for get_container()
Wrapper for get_object()
Wrapper for head_account()
Wrapper for head_container()
Wrapper for head_object()
Wrapper for post_account()
Wrapper for post_container()
Wrapper for post_object()
Wrapper for put_container()
Wrapper for put_object()
Delete a container
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP DELETE request failed |
Delete object
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP DELETE request failed |
Get a listing of containers for the account.
Parameters: |
|
---|---|
Returns: | a tuple of (response headers, a list of containers) The response headers will be a dict and all header names will be lowercase. |
Raises ClientException: | |
HTTP GET request failed |
Get authentication/authorization credentials.
The snet parameter is used for Rackspace’s ServiceNet internal network implementation. In this function, it simply adds snet- to the beginning of the host name for the returned storage URL. With Rackspace Cloud Files, use of this network path causes no bandwidth charges but requires the client to be running on Rackspace’s ServiceNet network.
Get a listing of objects for the container.
Parameters: |
|
---|---|
Returns: | a tuple of (response headers, a list of objects) The response headers will be a dict and all header names will be lowercase. |
Raises ClientException: | |
HTTP GET request failed |
Authenticate against a auth 2.0 server.
We are using the keystoneclient library for our 2.0 authentication.
Get an object
Parameters: |
|
---|---|
Returns: | a tuple of (response headers, the object’s contents) The response headers will be a dict and all header names will be lowercase. |
Raises ClientException: | |
HTTP GET request failed |
Get account stats.
Parameters: |
|
---|---|
Returns: | a dict containing the response’s headers (all header names will be lowercase) |
Raises ClientException: | |
HTTP HEAD request failed |
Get container stats.
Parameters: |
|
---|---|
Returns: | a dict containing the response’s headers (all header names will be lowercase) |
Raises ClientException: | |
HTTP HEAD request failed |
Get object info
Parameters: |
|
---|---|
Returns: | a dict containing the response’s headers (all header names will be lowercase) |
Raises ClientException: | |
HTTP HEAD request failed |
Make an HTTPConnection or HTTPSConnection
Parameters: |
|
---|---|
Returns: | tuple of (parsed url, connection object) |
Raises ClientException: | |
Unable to handle protocol scheme |
Update an account’s metadata.
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP POST request failed |
Update a container’s metadata.
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP POST request failed |
Update object metadata
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP POST request failed |
Create a container
Parameters: |
|
---|---|
Raises ClientException: | |
HTTP PUT request failed |
Put an object
Parameters: |
|
---|---|
Returns: | etag |
Raises ClientException: | |
HTTP PUT request failed |
Patched version of urllib.quote that encodes utf8 strings before quoting
store information about an operation into a dict
Parameters: |
|
---|
Bases: exceptions.Exception
Bases: exceptions.Exception
Bases: object
One object to manage context for multi-threading. This should make bin/swift less error-prone and allow us to test this code.
This object is a context manager and returns itself into the context. When entering the context, two printing threads are created (see below) and they are waited on and cleaned up when exiting the context.
A convenience method, queue_manager(), is provided to create a QueueFunctionManager context manager (a thread-pool with an associated input queue for work items).
Also, thread-safe printing to two streams is provided. The print_msg() method will print to the supplied print_stream (defaults to sys.stdout) and the error() method will print to the supplied error_stream (defaults to sys.stderr). Both of these printing methods will format the given string with any supplied *args (a la printf) and encode the result to utf8 if necessary.
The attribute self.error_count is incremented once per error message printed, so an application can tell if any worker threads encountered exceptions or otherwise called error() on this instance. The swift command-line tool uses this to exit non-zero if any error strings were printed.
Parameters: |
|
---|
Bases: object
A context manager to handle the life-cycle of a single Queue and a list of associated QueueFunctionThread instances.
This class is not usually instantiated directly. Instead, call the MultiThreadingManager.queue_manager() object method, which will return an instance of this class.
When entering the context, thread_count QueueFunctionThread instances are created and started. The input queue is returned. Inside the context, any work item put into the queue will get worked on by one of the QueueFunctionThread instances.
When the context is exited, all threads are sent a StopWorkerThreadSignal instance and then all threads are waited upon. Finally, any exceptions from any of the threads are reported on via the supplied thread_manager‘s error() method. If an error_counter list was supplied on instantiation, its first element is incremented once for every exception which occurred.
Parameters: |
|
---|
Bases: threading.Thread
Calls func` for each item in queue; func is called with a de-queued item as the first arg followed by *args and **kwargs.
Any exceptions raised by func are stored in self.exc_infos.
If the optional kwarg store_results is specified, it must be a list and each result of invoking func will be appended to that list.
Putting a StopWorkerThreadSignal instance into queue will cause this thread to exit.
Parameters: |
|
---|
Bases: object