Bases: exceptions.Exception
Bases: exceptions.Exception
Bases: eventlet.timeout.Timeout
Bases: eventlet.timeout.Timeout
Bases: eventlet.timeout.Timeout
Bases: exceptions.Exception
Bases: eventlet.timeout.Timeout
Max file size allowed for objects
Max number of metadata items
Max length of the name of a key for metadata
Max overall size of metadata
Max length of the value of a key for metadata
Max object name length
Helper function for checking if a string can be converted to a float.
Parameters: |
|
---|---|
Returns: | True if the string can be converted to a float, False otherwise |
Check metadata sent for objects in the request headers.
Parameters: |
|
---|---|
Raises HTTPBadRequest: | |
bad metadata |
Verify that the path to the device is a mount point and mounted. This allows us to fast fail on drives that have been unmounted because of issues, and also prevents us for accidently filling up the root partition.
Parameters: |
|
---|---|
Returns: | True if it is a valid mounted device, False otherwise |
Check to ensure that everything is alright about an object to be created.
Parameters: |
|
---|---|
Raises: |
|
Validate if a string can be encoded in xml.
Parameters: |
|
---|---|
Returns: | True if the string can be encoded in xml, False otherwise |
Miscellaneous utility functions for use with Swift.
Bases: object
Cheesy version of the LoggerAdapter available in Python 3
A no-op logger for eventlet wsgi.
Compute an ETA. Now only if we could also have a progress bar...
Parameters: |
|
---|---|
Returns: | ETA as a tuple of (length of time, unit of time) where unit of time is one of (‘h’, ‘m’, ‘s’) |
Drop ‘buffer’ cache for the given range of the given file.
Parameters: |
|
---|
Sets the userid of the current process
Parameters: |
|
---|
Pre-allocate disk space for a file file.
Parameters: |
|
---|
Get the current system logger using config settings.
Log config and defaults:
log_facility = LOG_LOCAL0
log_level = INFO
Parameters: |
|
---|
Get parameters from an HTTP request ensuring proper handling UTF-8 encoding.
Parameters: |
|
---|---|
Returns: | HTTP request parameter value |
Get a nomralized length of time in the largest unit of time (hours, minutes, or seconds.)
Parameters: |
|
---|---|
Returns: | A touple of (length of time, unit of time) where unit of time is one of (‘h’, ‘m’, ‘s’) |
Get the connonical hash for an account/container/object
Parameters: |
|
---|---|
Returns: | hash string |
Iterate over partitions accross all devices.
Parameters: |
|
---|---|
Returns: | Each iteration returns a tuple of (device, partition) |
Context manager that acquires a lock on the parent directory of the given file path. This will block until the lock can be acquired, or the timeout time has expired (whichever occurs first).
Parameters: |
|
---|
Context manager that acquires a lock on a directory. This will block until the lock can be acquired, or the timeout time has expired (whichever occurs first).
Parameters: |
|
---|
Ensures the path is a directory or makes it if not. Errors if the path exists but is a file or on permissions failure.
Parameters: |
|
---|
Format a timestamp (string or numeric) into a standardized xxxxxxxxxx.xxxxx format.
Parameters: |
|
---|---|
Returns: | normalized timestamp as a string |
Attempt to fix^H^H^Hhide race conditions like empty object directories being removed by backend processes during uploads, by retrying.
Parameters: |
|
---|
Validate and split the given HTTP request path.
Examples:
['a'] = split_path('/a')
['a', None] = split_path('/a', 1, 2)
['a', 'c'] = split_path('/a/c', 1, 2)
['a', 'c', 'o/r'] = split_path('/a/c/o/r', 1, 3, True)
Parameters: |
|
---|---|
Returns: | list of segments with a length of maxsegs (non-existant segments will return as None) |
Get the storage directory
Parameters: |
|
---|---|
Returns: | Storage directory |
Remove any file in a given path that that was last modified before mtime.
Parameters: |
|
---|---|
Mtime : | Timestamp of oldest file to keep |
Get the machine’s ip addresses using ifconfig
Returns: | list of Strings of IPv4 ip addresses |
---|
Bases: object
Auth Middleware that uses the dev auth server
Dev authorization implmentation
Parameters: |
|
---|---|
Returns: | True if authorization is successful, False otherwise |
WSGI tools for use with swift.
mimetools.Message defaults content-type to “text/plain” This changes it to default to None, so we can detect missing headers.
Loads common settings from conf, then instantiates app and runs the server using the specified number of workers.
Parameters: |
|
---|
Cloud Files client library used internally
Bases: exceptions.Exception
Bases: object
Convenience class to make requests that will also retry the request
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_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 list of accounts |
Raises ClientException: | |
HTTP GET request failed |
Get authentication credentials
Parameters: |
|
---|---|
Returns: | tuple of (storage URL, storage token, auth token) |
Raises ClientException: | |
HTTP GET request to auth URL failed |
Get a listing of objects for the container.
Parameters: |
|
---|---|
Returns: | a list of objects |
Raises ClientException: | |
HTTP GET request failed |
Get an object
Parameters: |
|
---|---|
Returns: | a list of objects |
Raises ClientException: | |
HTTP GET request failed |
Get account stats.
Parameters: |
|
---|---|
Returns: | a tuple of (container count, object count, bytes used) |
Raises ClientException: | |
HTTP HEAD request failed |
Get container stats.
Parameters: |
|
---|---|
Returns: | a tuple of (object count, bytes used) |
Raises ClientException: | |
HTTP HEAD request failed |
Get object info
Parameters: |
|
---|---|
Returns: | a tuple of (content type, content length, last modfied, etag, dictionary of metadata) |
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 |
Change 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 from server response |
Raises ClientException: | |
HTTP PUT request failed |
Patched version of urllib.quote that encodes utf8 strings before quoting
Internal client library for making calls directly to the servers rather than through the proxy.
Delete object directly from the object server.
Parameters: |
|
---|---|
Returns: | response from server |
Get container listings directly from the container server.
Parameters: |
|
---|---|
Returns: | list of objects |
Get object directly from the object server.
Parameters: |
|
---|---|
Returns: | object |
Request container information directly from the container server.
Parameters: |
|
---|---|
Returns: | tuple of (object count, bytes used) |
Request object information directly from the object server.
Parameters: |
|
---|---|
Returns: | tuple of (content-type, object size, last modified timestamp, etag, metadata dictionary) |
Helper function to retry a given function a number of times.
Parameters: |
|
---|---|
Returns: | restult of func |
Monkey Patch httplib.HTTPResponse to buffer reads of headers. This can improve performance when making large numbers of small HTTP requests. This module also provides helper functions to make HTTP connections using BufferedHTTPResponse.
Warning
If you use this, be sure that the libraries you are using do not access the socket directly (xmlrpclib, I’m looking at you :/), and instead make all calls through httplib.
Bases: httplib.HTTPConnection
HTTPConnection class that uses BufferedHTTPResponse
alias of BufferedHTTPResponse
Bases: httplib.HTTPResponse
HTTPResponse class that buffers reading of headers
Helper function to create a HTTPConnection object that is buffered for backend Swift services.
Parameters: |
|
---|---|
Returns: | HTTPConnection object |
Helper function to create a HTTPConnection object that is buffered.
Parameters: |
|
---|---|
Returns: | HTTPConnection object |
Bases: object
Basic controller used for monitoring.
Lucid comes with memcached: v1.4.2. Protocol documentation for that version is at:
http://github.com/memcached/memcached/blob/1.4.2/doc/protocol.txt
Bases: object
Simple, consistent-hashed memcache client.
Deletes a key/value pair from memcache.
Parameters: |
|
---|
Gets the object specified by key. It will also unpickle the object before returning if it is pickled in memcache.
Parameters: |
|
---|---|
Returns: | value of the key in memcache |
Gets multiple values from memcache for the given keys.
Parameters: |
|
---|---|
Returns: | list of values |
Increments a key which has a numeric value by delta. If the key can’t be found, it’s added as delta.
Parameters: |
|
---|
Set a key/value pair in memcache
Parameters: |
|
---|
Sets multiple key/value pairs in memcache.
Parameters: |
|
---|