Skip to content
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

Implement streams API #157

Closed
13 tasks done
mijicd opened this issue Nov 20, 2020 · 3 comments
Closed
13 tasks done

Implement streams API #157

mijicd opened this issue Nov 20, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request zio-hackathon ZIO Hackathon 2020

Comments

@mijicd
Copy link
Member

mijicd commented Nov 20, 2020

Extracted from this comment authored by @regis-leray.

Commands

  • XINFO [CONSUMERS key groupname] [GROUPS key] [STREAM key] [HELP] Get information on streams and consumer groups
  • XADD key ID field value [field value ...] Appends a new entry to a stream
  • XTRIM key MAXLEN [] count Trims the stream to (approximately if '' is passed) a certain size
  • XDEL key ID [ID ...] Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist.
  • XRANGE key start end [COUNT count] Return a range of elements in a stream, with IDs matching the specified IDs interval
  • XREVRANGE key end start [COUNT count] Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE
  • XLEN key Return the number of entires in a stream
  • XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...] Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block.
  • XGROUP [CREATE key groupname id-or-$] [SETID key groupname id-or-$] [DESTROY key groupname] [DELCONSUMER key groupname consumername] Create, destroy, and manage consumer groups.
  • XREADGROUP GROUP group consumer [COUNT count] [BLOCK milliseconds] [NOACK] STREAMS key [key ...] ID [ID ...] Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block.
  • XACK key group ID [ID ...] Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL.
  • XCLAIM key group consumer min-idle-time ID [ID ...] [IDLE ms] [TIME ms-unix-time] [RETRYCOUNT count] [FORCE] [JUSTID] Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer.
  • XPENDING key group [start end count] [consumer] Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged.

Tips

  • Define the API in zio.redis.api.
  • Command-specific options should be defined in zio.redis.options.
  • Additional inputs and outputs can be defined in zio.redis.Input and zio.redis.Output, respectively.
  • Redis API evolves, therefore the commands listed above might be slightly changed. Double check the official docs before starting with implementation.
  • Use telnet to understand command protocol details.
  • Write inputs and outputs tests in zio.redis.InputSpec and zio.redis.OutputSpec, respectively.
  • Write integration tests by expanding the zio.redis.ApiSpec.
  • If you feel that the pull request size is growing out of control, feel free to split it but make sure to link this issue in each of the related PRs.
@mijicd mijicd added enhancement New feature or request zio-hackathon ZIO Hackathon 2020 labels Nov 20, 2020
@anovakovic01
Copy link
Member

Features that are supported in the Redis version 6.2+:

  • CREATECONSUMER subcommand for XGROUP,
  • IDLE option for XPENDING.

@mijicd
Copy link
Member Author

mijicd commented Nov 29, 2020

@anovakovic01 I propose closing this ticket and opening the new one for the functionality you just mentioned. Since this is something we're not able to support at the moment, let's create a separate label for it.

@mijicd
Copy link
Member Author

mijicd commented Mar 14, 2021

Closed in #233 and #301

@mijicd mijicd closed this as completed Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request zio-hackathon ZIO Hackathon 2020
Projects
None yet
Development

No branches or pull requests

2 participants