You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2025/04/07 11:57:12 UTC
Re: [PR] feat:add tls support fot memcached [opendal]
Xuanwo commented on code in PR #5471:
URL: https://github.com/apache/opendal/pull/5471#discussion_r2031080907
##########
core/src/services/memcached/binary.rs:
##########
@@ -98,11 +98,11 @@ pub struct Response {
}
pub struct Connection {
- io: BufReader<TcpStream>,
+ io: BufReader<Box<dyn Connect>>,
}
Review Comment:
How about using:
```rust
pub struct Connection<IO: AsyncRead + AsyncWrite>{
io: IO,
}
```
So we don't need to `Box<dyn Connect>` here?
##########
core/src/services/memcached/binary.rs:
##########
@@ -287,3 +291,12 @@ pub async fn parse_response(reader: &mut TcpStream) -> Result<Response> {
value,
})
}
+
+#[async_trait::async_trait]
+pub trait Connect:
+ AsyncWrite + std::marker::Unpin + tokio::io::AsyncRead + std::marker::Send
+{
+}
+
+impl Connect for TcpStream {}
+impl Connect for TlsStream<TcpStream> {}
Review Comment:
Maybe we don't this trait?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org