dynalite icon indicating copy to clipboard operation
dynalite copied to clipboard

DynamoDB Streams

Open kiril-pirozenko-home24 opened this issue 8 years ago • 7 comments

This is rough implementation of DynamoDB Streams API. The intent of this PR is to gather feedback.

TODO:

  • Add streams support to following actions:
    • UpdateTable
    • DeleteTable
    • BatchWriteItems
  • Improve streams support:
    • ListStreams does not filter streams by table name
    • Respect StreamViewType from StreamSpecification (currently they always work as if NEW_AND_OLD_IMAGES was provided)
    • Stream records have eventID equal to SequenceNumber
    • Shard iterator is valid indefinitely (should be valid only for 15min)
  • Improve tests:
    • Add tests to check request validations
  • Consider adding following functionality (optional):
    • Support for multiple shards per stream (DynamoDB does not specify maximum shard size, so it's perfectly fine to have only one per stream, but it might be useful to be able to emulate multiple shards)
    • Support for record trimming (DynamoDB stores items for 24h only, but I'm not sure whether it would be useful to emulate that)

Implements: #66

kiril-pirozenko-home24 avatar Dec 20 '16 14:12 kiril-pirozenko-home24

Wow, @kiril-pirozenko-home24 this is a huge undertaking – respect!

Before you go any further though – my original thoughts were that it would be a lot easier to just borrow a lot of the stream code from https://github.com/mhart/kinesalite – considering that Kinesis and DynamoDB Streams are very similar.

Is this something you considered at all?

mhart avatar Dec 20 '16 16:12 mhart

Thank you!

No, haven't checked kinesalite at all. Our first goal was to have basic working mock for our services.

Could you have a look at code/functionality/TODO posted above and add what's missing for this PR to be mergeable? Maybe a checklist of your requirements to accept a PR? Because, you know, other business priorities... need to balance all this stuff 🙂 It would be helpful to see a scope of this task.

In general I approve of code borrowing 🙂 How about using more modern JS features? Do you have any requirements for minimum Node version supported? What's your take on tools like Typescript?

kiril-pirozenko-home24 avatar Dec 21 '16 09:12 kiril-pirozenko-home24

Oh man. This is amazing!

From a usability point of view, it would be nice to be able to wire up triggers with something like dynalite.stream('table', function(){}). It would also be nice to know how many records are in the stream so you can wait for the streams to empty before continuing.

mcwhittemore avatar Jan 03 '17 23:01 mcwhittemore

Hi, I love this (and actually need this). Can I help you with finishing this?

jakubriedl avatar Apr 03 '17 08:04 jakubriedl

+1 on the request for stream support and triggers

andrewkrug avatar Apr 06 '17 21:04 andrewkrug

I just wanted to write to report that I've used @kiril-pirozenko-home24's fork and his streams implementation seems to work extremely well. I hope this PR gets accepted eventually

ZECTBynmo avatar May 01 '17 03:05 ZECTBynmo

Revisiting this now (7 years later!), also seeing what went down over in https://github.com/architect/dynalite/pull/88, I'm wondering if we can't reignite this PR by pulling out the Kinesalite internals we want and using them here (with credit!), without adding it as a dependency? I'm open to ideas, would love to see this move forward again as well.

ryanblock avatar Aug 30 '23 02:08 ryanblock