Enable unix sockets for Client creations: - #504
Open
Kropyls wants to merge 2 commits into
Open
Conversation
Build to be compatable with all pre-existing usages client.py: - Flag client now uses a port value of 0 to infer a unix socket - holds onto a self._unix boolean (mostly for easy referencing) - Client takes overloads for host/port or path combo - if path is provided, overwrites any host/port value given pool.py: - change self._host to self._target to make clear that it could be IP or path - add self._unix and self._opener values - add _make_opener to MemcachePool: - this controls generating an opener function that will be slightly different for domain/ip sockets - _create_new_conn now calls the self._opener value to open connections simple.py: - add a comment explaining how to use local sockets, and showing that it won't break existing code commands_test.py: - add a test for domain socket setting/setting conftest.py: - build up Params around unix sockets following the existing pattern for IP-based socks - fix host assisnment in mcache_server_docker pool_test.py: - add test for unix socket aquire/release - add a bad path test for local sockets - adjust test_bad_connection MemcachePool creation call to work (the new opener pulls host during creation, but it was being changed inside the test originally)
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.
Fixes: #325
Hey everyone, I saw that this had been sitting in limbo for a while with another PR that seems dead, and this would be a nice-to-have for me in my day-job, so I tried my own take at it. I'm always open to all negative/positive feedback.
What do these changes do?
This enables users to create a Client() with the "path" keyword for users who need a local socket connection. The general idea was to try to do this in a way that didn't break any per-existing consumers of the code, so I forced the path into a keyword argument so all existing behavior goes unaffected.
Details below:
client.py:
pool.py:
simple.py:
commands_test.py:
conftest.py:
pool_test.py:
Are there changes in behavior for the user?
I've added a path kwarg they can call, but all per-existing code should still work as is.
Checklist