Skip to content

Read without writer - #158

Merged
zhenlineo merged 6 commits into
neo4j:1.3from
zhenlineo:1.3-read-without-writer
Apr 28, 2017
Merged

Read without writer#158
zhenlineo merged 6 commits into
neo4j:1.3from
zhenlineo:1.3-read-without-writer

Conversation

@zhenlineo

Copy link
Copy Markdown
Contributor

Based on #157 supporting routing context in bolt uri

Comment thread neo4j/addressing.py Outdated
context = {}
parameters = [x for x in query.split('&') if x]
for keyValue in parameters:
pair = keyValue.split('=')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key, _, value = keyValue.partition("=")
if not key or not value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread neo4j/v1/direct.py Outdated
# 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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no Routing

Comment thread neo4j/v1/routing.py Outdated
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and self.routers

Comment thread neo4j/v1/routing.py Outdated
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return self.call_get_servers, {}

Comment thread neo4j/v1/routing.py Outdated
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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connections = [None]

def connector(_):
connection = self.acquire_direct(address)
connections[0] = connection
return connection

with BoltSession(connector) as session:
last_connection = connections[0]

Comment thread neo4j/v1/routing.py Outdated
raise ServiceUnavailable("Unable to retrieve routing information")

def refresh_routing_table(self):
def ensure_routing_table(self, access_mode):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure_routing_table_is_fresh

@zhenlineo
zhenlineo force-pushed the 1.3-read-without-writer branch 3 times, most recently from 0e3d67e to 1cc9ac8 Compare April 27, 2017 15:35
@zhenlineo
zhenlineo force-pushed the 1.3-read-without-writer branch from 1cc9ac8 to fe7554e Compare April 27, 2017 15:54
@zhenlineo
zhenlineo force-pushed the 1.3-read-without-writer branch from 87677b0 to 3cb094a Compare April 28, 2017 12:40
@zhenlineo
zhenlineo merged commit ed27f5e into neo4j:1.3 Apr 28, 2017
@zhenlineo
zhenlineo deleted the 1.3-read-without-writer branch April 28, 2017 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant