You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2024/11/10 06:34:56 UTC

[PR] feat(services/redis): add support of list operation [opendal]

PragmaTwice opened a new pull request, #5304:
URL: https://github.com/apache/opendal/pull/5304

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # Rationale for this change
   
   Currently only read and write is supported for redis service.
   
   After #5208 we can have a better support for kv scanning, so list supporting for redis is relatively easy to implement and can be efficient.
   
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   
   We support (async) list operation for redis service via `kv::Adaptor::scan` to fetch paged key lists with a prefix using Redis SCAN command.
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   User now can perform list on redis schema.
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking-changes` label.
   -->
   


-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #5304:
URL: https://github.com/apache/opendal/pull/5304#issuecomment-2783046419

   Hi @PragmaTwice, I'm working on https://github.com/apache/opendal/issues/5739 now. And I'm guessing this PR won't be needed anymore after that. Thank you for your working!


-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on PR #5304:
URL: https://github.com/apache/opendal/pull/5304#issuecomment-2467802834

   Fixed.


-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5304:
URL: https://github.com/apache/opendal/pull/5304#discussion_r1836504255


##########
core/src/services/redis/backend.rs:
##########
@@ -326,8 +342,43 @@ impl Adapter {
     }
 }
 
+#[self_referencing]
+struct RedisAsyncConnIter<'a> {
+    conn: bb8::PooledConnection<'a, RedisConnectionManager>,
+
+    #[borrows(mut conn)]
+    #[not_covariant]
+    iter: AsyncIter<'this, String>,
+}
+
+#[self_referencing]
+pub struct RedisScanner {
+    pool: bb8::Pool<RedisConnectionManager>,

Review Comment:
   We could extract `RedisCore` as other services do and use `Arc<RedisCore>` here to avoid duplicate calls like `conn_from_pool`.



##########
core/src/services/redis/backend.rs:
##########
@@ -326,8 +342,43 @@ impl Adapter {
     }
 }
 
+#[self_referencing]
+struct RedisAsyncConnIter<'a> {
+    conn: bb8::PooledConnection<'a, RedisConnectionManager>,
+
+    #[borrows(mut conn)]
+    #[not_covariant]
+    iter: AsyncIter<'this, String>,
+}
+
+#[self_referencing]
+pub struct RedisScanner {
+    pool: bb8::Pool<RedisConnectionManager>,
+    path: String,
+
+    #[borrows(pool, path)]
+    #[not_covariant]
+    inner: RedisAsyncConnIter<'this>,
+}
+
+unsafe impl Sync for RedisScanner {}
+
+impl Stream for RedisScanner {

Review Comment:
   Hi, how about implement `kv::Scan` directly without go through `Stream`?



-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5304:
URL: https://github.com/apache/opendal/pull/5304#discussion_r1836879813


##########
core/src/services/redis/backend.rs:
##########
@@ -336,6 +387,12 @@ impl kv::Adapter for Adapter {
             Capability {
                 read: true,
                 write: true,
+                // due to limitation of Redis itself,

Review Comment:
   Thank you, this is the first time I've learned this. Would you like to add a note in the documents about this backend to make it clear to users?



-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed pull request #5304: feat(services/redis): add support of list operation
URL: https://github.com/apache/opendal/pull/5304


-- 
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


Re: [PR] feat(services/redis): add support of list operation [opendal]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on PR #5304:
URL: https://github.com/apache/opendal/pull/5304#issuecomment-2467207513

   Funny to see it succeeded on redis but failed on redis cluster and kvrocks.


-- 
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