Add stop at timestamp flag - #5
Open
adammw wants to merge 2 commits into
Open
Conversation
grosser
reviewed
Jul 28, 2018
| } | ||
|
|
||
| func streamRecords(client kinesisiface.KinesisAPI, shardIterator string, fn func(*[]byte)) { | ||
| func streamRecords(client kinesisiface.KinesisAPI, shardIterator string, filter func(*kinesis.Record) bool, fn func(*[]byte)) { |
grosser
reviewed
Jul 28, 2018
|
|
||
| // yields each record from given record or aggregatedRecords | ||
| func eachRecord(aggregatedRecords []*kinesis.Record, fn func(*[]byte)) { | ||
| func eachRecord(aggregatedRecords []*kinesis.Record, filter func(*kinesis.Record) bool, fn func(*[]byte)) (filterResponse bool) { |
Collaborator
There was a problem hiding this comment.
how about doing this outside, does not need to involve eachRecord ?
Owner
Author
There was a problem hiding this comment.
doing it outside removes the ability to do a break on the loop. which i guess is fine for the number of records there are... also has the advantage of picking up any other records in the response that are for some reason out of order.
Collaborator
There was a problem hiding this comment.
the break is good / should stay ... maybe like this:
eachRecord(resp.Records, func(record){
if(filter(record)) { fn(record) } else { break }
})
grosser
reviewed
Jul 28, 2018
| IteratorType string `short:"t" long:"iterator-type" description:"Shard Iterator Type" default:"LATEST" choice:"AT_SEQUENCE_NUMBER" choice:"AFTER_SEQUENCE_NUMBER" choice:"AT_TIMESTAMP" choice:"TRIM_HORIZON" choice:"LATEST"` | ||
| Timestamp int64 `long:"timestamp" description:"Starting timestamp (used with AT_TIMESTAMP iterator)"` | ||
| SequenceNumber string `long:"sequence-number" description:"Starting sequence number (used with *_SEQUENCE_NUMBER iterators)"` | ||
| StopAtTimestamp int64 `long:"stop-at-timestamp" description:"Stop when timestamp is reached"` |
Collaborator
There was a problem hiding this comment.
say that it needs to be a unix timestamp ... ideally support date parsing
grosser
approved these changes
Jul 28, 2018
grosser
left a comment
Collaborator
There was a problem hiding this comment.
looks like it should work ... it might lose some record if they come in out of order, but thats a harder problem ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/cc @grosser