-
Notifications
You must be signed in to change notification settings - Fork 30
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
Put record options #2
Conversation
Philmod
commented
Feb 4, 2014
- options to set ExplicitHashKey and SequenceNumberForOrdering
- emit the shardId/sequenceNumber with the data
Cool! Just looking through it now |
@@ -134,7 +134,7 @@ function getRecords(data, cb) { | |||
for (i = 0; i < res.Records.length; i++) { | |||
record = res.Records[i] | |||
self.shardIds[data.ShardId].lastSequenceNumber = record.SequenceNumber | |||
self.emit('data', new Buffer(record.Data, 'base64')) | |||
self.emit('data', new Buffer(record.Data, 'base64'), {shardId: data.ShardId, sequenceNumber: record.SequenceNumber}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, this is not how data emitting or streams usually work. The data event should just have one parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to know which sequence/shardId is linked to the data, not in another event.
Otherwise we can construct a Object there:
self.emit('data', {
data: new Buffer(record.Data, 'base64'),
shardId: data.ShardId,
sequenceNumber: record.SequenceNumber
});
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we'd need to support two modes for the stream - one being objectMode
and one just normal buffer stream mode (you can't emit objects unless the stream is in objectMode
)
We could have an option passed in to the constructor for this.
Resolved in 9375e2b and released as 0.2.0 - thanks for the contribution! (So you'll probably want to use |