Read without writer - #158
Merged
Merged
Conversation
zhenlineo
commented
Apr 26, 2017
| context = {} | ||
| parameters = [x for x in query.split('&') if x] | ||
| for keyValue in parameters: | ||
| pair = keyValue.split('=') |
Contributor
Author
There was a problem hiding this comment.
key, _, value = keyValue.partition("=")
if not key or not value
Contributor
Author
There was a problem hiding this comment.
zhenlineo
commented
Apr 26, 2017
| # the connection pool may contain multiple IP address keys, one for | ||
| # an old address and one for a new address. | ||
| if SocketAddress.parse_routing_context(uri): | ||
| raise ValueError("Routing parameters are not supported with scheme 'bolt'. Given URI: '%s'." % uri) |
zhenlineo
commented
Apr 26, 2017
| expired = self.last_updated_time + self.ttl <= self.timer() | ||
| return not expired and len(self.routers) > 1 and self.readers and self.writers | ||
| has_server_for_mode = (access_mode == READ_ACCESS and self.readers) or (access_mode == WRITE_ACCESS and self.writers) | ||
| return not expired and len(self.routers) >= 1 and has_server_for_mode |
zhenlineo
commented
Apr 26, 2017
| if ServerVersion.from_str(connection.server.version).at_least_version(3, 2): | ||
| return self.call_get_routing_table, {self.get_routing_table_param: self.routing_context} | ||
| else: | ||
| return self.call_get_servers |
Contributor
Author
There was a problem hiding this comment.
return self.call_get_servers, {}
zhenlineo
commented
Apr 26, 2017
| try: | ||
| with BoltSession(lambda _: self.acquire_direct(address)) as session: | ||
| return list(session.run("CALL %s" % self.routing_info_procedure)) | ||
| connection = self.acquire_direct(address) |
Contributor
Author
There was a problem hiding this comment.
connections = [None]
def connector(_):
connection = self.acquire_direct(address)
connections[0] = connection
return connection
with BoltSession(connector) as session:
last_connection = connections[0]
zhenlineo
commented
Apr 26, 2017
| raise ServiceUnavailable("Unable to retrieve routing information") | ||
|
|
||
| def refresh_routing_table(self): | ||
| def ensure_routing_table(self, access_mode): |
Contributor
Author
There was a problem hiding this comment.
ensure_routing_table_is_fresh
added 4 commits
April 27, 2017 15:57
zhenlineo
force-pushed
the
1.3-read-without-writer
branch
3 times, most recently
from
April 27, 2017 15:35
0e3d67e to
1cc9ac8
Compare
zhenlineo
force-pushed
the
1.3-read-without-writer
branch
from
April 27, 2017 15:54
1cc9ac8 to
fe7554e
Compare
zhenlineo
force-pushed
the
1.3-read-without-writer
branch
from
April 28, 2017 12:40
87677b0 to
3cb094a
Compare
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.
Based on #157 supporting routing context in bolt uri