First draft of changes to the HTTP client#56
Closed
gstein wants to merge 15 commits intobasho:masterfrom
Closed
Conversation
multiple hosts, passing them out for use. Both HTTP and bare sockets are supported. * riak/transports/connection.py: (ConnectionManager): new base class for managing connections (HTTPConnectionManager): manage HTTP connections (Socket): new connection type, for bare sockets (SocketConnectionManager): manage bare socket connections (NoHostsDefined): simple exception when we cannot open a conn * riak/transports/http.py: (RiakHttpTransport.__init__): use a connection manager (RiakHttpTransport.__copy__): disable for now (RiakHttpTransport.parse_body): can't print host/port right now (RiakHttpTransport.http_request): rebuild to use the connection manager.
…open a connection to the Riak server(s) once its host/port is defined. When a host (and port) is removed from the hostport set, then remove connections.
…t is redundant, given the new RiakHttpTransport capabilities)
Contributor
Author
|
This branch passes the tests for me (many are skipped due to: no protobuf, no urllib3, SKIP_SEARCH=1, SKIP_LUWAK=1). |
* riak/transports/connection.py:
(ConnectionManager.add_hostport): fix typo: s/conn/conns/
(Connectionmanager.remove_host): tweak control flow to move conn.close()
outside of the try/except.
Create an appropriate CM and pass that to the transport. We also adjust the constructor signature and allow for arbitrary options to be passed to the transport (eg. Http takes a prefix and mapred_prefix). Some backwards compat code has been introduced in all transports (other than the basic RiakHttpTransport) to extract a host/port pair from the CM. This commit also re-enables testing of RiakHttpReuseTransport, even though it is busted and should go away "soon".
* riak/transports/transport.py:
(RiakTransport): document the 'api' classvar, but not enter a default.
all subclasses must provide the default explicitly.
* riak/transports/http.py:
(RiakHttpTransport): notate the class is now API v2.
* riak/transports/pbc.py:
(RiakPbcTransport): notate the class is now API v2.
* riak/client.py:
(RiakClient.__init__): handle api < 2 transports
* riak/search.py:
(RiakSearch.__init__): if api < 2, then raise a deprecation warning. the
old code would simply fail, so we are "allowed" to bail out.
Conflicts:
riak/util.py
-- simple conflict due to diff context change. fixed imports.
This also closes connections whenever an error occurs, for safety. This ensures the HTTPConnection object returns to a usable state.
Contributor
Author
|
This work is subsumed into the "merge_greg" branch, which is part of pull request #85. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch builds from my "relax-deps" and "simplify" branches, so there are many changes relative to master. The "relax-deps" is not required, but a few of the changes in "simplify" are needed for this branch to work.
This branch is a beginning for a revamp of the original HTTP client (and elimination of the extended clients). It needs more documentation and comments, but I'd like an initial review for it.
The ConnectionManager in this branch can also be used to revamp pbc.py, but those changes are not in this branch.