Skip to content

Add stop at timestamp flag - #5

Open
adammw wants to merge 2 commits into
masterfrom
adammw/stop-at-timestamp
Open

Add stop at timestamp flag#5
adammw wants to merge 2 commits into
masterfrom
adammw/stop-at-timestamp

Conversation

@adammw

@adammw adammw commented Jul 28, 2018

Copy link
Copy Markdown
Owner

/cc @grosser

Comment thread pkg.go
}

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more like stopDetector ?

Comment thread pkg.go

// 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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about doing this outside, does not need to involve eachRecord ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the break is good / should stay ... maybe like this:

eachRecord(resp.Records, func(record){
  if(filter(record)) { fn(record) } else { break }
})

Comment thread pkg.go
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"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

say that it needs to be a unix timestamp ... ideally support date parsing

@grosser grosser left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it should work ... it might lose some record if they come in out of order, but thats a harder problem ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants