basho/riak-python-client — pull request #179 by seancribbs (2012-12-27 17:07:09+00:00)
Title: The Big Transport Refactor

*NOTE: This is a work-in-progress, seeking early comments. The code does not yet work!*

The internal structure of the client has limited us from doing several important things listed below. This branch is an effort to restructure the internals, while maintaining some amount of API compatibility with the old version, and warning users of deprecated/removed/disabled patterns. The partially-completed items are:

* **Connection manager and monitor are gone.** The relationship between the connection manager and the transport implementation was reversed. Instead it has been replaced with the `Pool` class, one for each transport type. The monitor never worked anyway!
* **Transport implementations are broken up into multiple files for clarity.**
* **Streaming operations (list-keys, MapReduce) are supported**, implemented as iterators. Example:

```python
for key in bucket.stream_keys():
print key
```

* **All request operations go through the RiakClient object**, which handles the connection pools. Accessing the transport directly is now forbidden.
* **The client can connect to multiple nodes**, and each node has an associated error rate (to be used later when implementing error recovery). The node selected for new connections depends on the error rate.
* **Retry/recovery from network failures and down nodes will be automatic.** Failed requests will be retried on other nodes and bump the error rate for the failed node.