Table Of Contents

Previous topic

Partitioned Consistent Hash Ring

Next topic

Account

This Page

Proxy

Proxy Server

class swift.proxy.server.Application(conf, memcache=None, logger=None, account_ring=None, container_ring=None, object_ring=None)

Bases: object

WSGI application for the proxy server.

error_limit(node, msg)

Mark a node as error limited. This immediately pretends the node received enough errors to trigger error suppression. Use this for errors like Insufficient Storage. For other errors use error_occurred().

Parameters:
  • node – dictionary of node to error limit
  • msg – error message
error_limited(node)

Check if the node is currently error limited.

Parameters:node – dictionary of node to check
Returns:True if error limited, False otherwise
error_occurred(node, msg)

Handle logging, and handling of errors.

Parameters:
  • node – dictionary of node to handle errors for
  • msg – error message
exception_occurred(node, typ, additional_info)

Handle logging of generic exceptions.

Parameters:
  • node – dictionary of node to log the error for
  • typ – server type
  • additional_info – additional information to log
get_controller(path)

Get the controller to handle a request.

Parameters:path – path from request
Returns:tuple of (controller class, path dictionary)
Raises:ValueError (thrown by split_path) if given invalid path
handle_request(req)

Entry point for proxy server. Should return a WSGI-style callable (such as swob.Response).

Parameters:req – swob.Request object
iter_nodes(ring, partition, node_iter=None)

Yields nodes for a ring partition, skipping over error limited nodes and stopping at the configurable number of nodes. If a node yielded subsequently gets error limited, an extra node will be yielded to take its place.

Note that if you’re going to iterate over this concurrently from multiple greenthreads, you’ll want to use a swift.common.utils.GreenthreadSafeIterator to serialize access. Otherwise, you may get ValueErrors from concurrent access. (You also may not, depending on how logging is configured, the vagaries of socket IO and eventlet, and the phase of the moon.)

Parameters:
  • ring – ring to get yield nodes from
  • partition – ring partition to yield nodes for
  • node_iter – optional iterable of nodes to try. Useful if you want to filter or reorder the nodes.
set_node_timing(node, timing)
sort_nodes(nodes)

Sorts nodes in-place (and returns the sorted list) according to the configured strategy. The default “sorting” is to randomly shuffle the nodes. If the “timing” strategy is chosen, the nodes are sorted according to the stored timing data.

update_request(req)
swift.proxy.server.app_factory(global_conf, **local_conf)

paste.deploy app factory for creating WSGI proxy apps.