-
Notifications
You must be signed in to change notification settings - Fork 703
feat(services/memcached): Support connection via unix domain socket #7112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Switch dependency from `http` to `url` for endpoint parsing. - Introduce `SocketStream` to handle both `TcpStream` and `UnixStream`.
- Add `#[cfg(unix)]` checks for UnixSocket usage. - Refactor connection manager to use `Endpoint` enum.
|
This is a small change and shouldn't affect existing logic. |
|
Hello, can you take a look? @Xuanwo |
Xuanwo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. The change looks good to me, but it lacks service test coverage. Could you add a test here to connect Memcached with a socket?
https://github.com/apache/opendal/tree/main/.github/services/memcached
- Add docker-compose-memcached-unix.yml for Unix socket setup - Add memcached_with_unix action for CI testing
Which issue does this PR close?
Rationale for this change
Currently, the
memcachedservice only supports TCP connections. However, in many local or containerized environments, connecting via Unix Domain Sockets (UDS) is preferred for better performance or security.This PR introduces support for UDS and refactors the connection logic to handle different transport protocols uniformly.
What changes are included in this PR?
httptourlcrate for more flexible endpoint parsing (specifically for non-HTTP schemes likeunix).SocketStreamenum to unifyTcpStreamandUnixStreamimplementations underAsyncReadandAsyncWrite.unix://schemes and support local socket paths.Are there any user-facing changes?
Yes. Users can now configure the
endpointwith theunixscheme to connect via a Unix Domain Socket.Example:
unix:///tmp/memcached.sockExisting TCP configurations (e.g.,
127.0.0.1:11211) remain unaffected.AI Usage Statement
This PR was developed with assistance from GitHub Copilot (Claude Opus 4.5).