You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "torwig (via GitHub)" <gi...@apache.org> on 2023/02/08 11:34:42 UTC

[GitHub] [incubator-kvrocks] torwig opened a new pull request, #1251: Add optional args to XLEN to specify start ID and direction

torwig opened a new pull request, #1251:
URL: https://github.com/apache/incubator-kvrocks/pull/1251

   Syntax: `XLEN stream_name [entry_id] [direction]`. 
   Where direction can be '-' or '+' (special IDs mean respectively the first and the last elements in the stream). Default value: '+'. 
   
   If an optional entry ID is specified, the XLEN command returns the number of entries between that ID and the first/last element of the stream. 
   
   The element with the specified ID is not considered - it serves as an exclusive boundary. If the stream doesn't contain an entry with the specified ID, the command starts counting from the closest entry to the first/last element in the stream. 
   
   If the specified ID is equal to or greater than the last entry ID and: 
   a) direction is '+' - the command returns 0
   b) direction is '-' - the command returns the stream's size 
   
   If the specified ID is equal to or less than the first entry ID and: 
   a) direction is '-' the command returns 0
   b) direction is '+' the command returns stream's size 
   
   This feature is helpful in finding:
   a) how many entries in the stream were processed so far 
   b) how many unprocessed entries  (ahead of the current one) are in the stream
   
   Complexity: O(n)


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #1251: Add optional args to XLEN to specify start ID and direction

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on code in PR #1251:
URL: https://github.com/apache/incubator-kvrocks/pull/1251#discussion_r1100035148


##########
src/commands/cmd_stream.cc:
##########
@@ -212,10 +212,33 @@ class CommandXDel : public Commander {
 
 class CommandXLen : public Commander {
  public:
+  Status Parse(const std::vector<std::string> &args) override {
+    stream_name_ = args[1];

Review Comment:
   `stream_name_` looks unused.



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] torwig merged pull request #1251: Add optional args to XLEN to specify start ID and direction

Posted by "torwig (via GitHub)" <gi...@apache.org>.
torwig merged PR #1251:
URL: https://github.com/apache/incubator-kvrocks/pull/1251


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] torwig commented on a diff in pull request #1251: Add optional args to XLEN to specify start ID and direction

Posted by "torwig (via GitHub)" <gi...@apache.org>.
torwig commented on code in PR #1251:
URL: https://github.com/apache/incubator-kvrocks/pull/1251#discussion_r1100046554


##########
src/commands/cmd_stream.cc:
##########
@@ -212,10 +212,33 @@ class CommandXDel : public Commander {
 
 class CommandXLen : public Commander {
  public:
+  Status Parse(const std::vector<std::string> &args) override {
+    stream_name_ = args[1];

Review Comment:
   @git-hulk Yes, you're right. I'll fix it right now.



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] torwig commented on pull request #1251: Add optional args to XLEN to specify start ID and direction

Posted by "torwig (via GitHub)" <gi...@apache.org>.
torwig commented on PR #1251:
URL: https://github.com/apache/incubator-kvrocks/pull/1251#issuecomment-1422639608

   Thanks all. Merging...


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org