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

Streaming Api Changes #39

Closed
jorgebay opened this issue Nov 26, 2013 · 5 comments
Closed

Streaming Api Changes #39

jorgebay opened this issue Nov 26, 2013 · 5 comments
Assignees

Comments

@jorgebay
Copy link
Owner

(coming from #37)

Create a new method:

var stream = client.stream(query, [params], [consistency], endCallback);

Returns a readable stream2 that emits row objects.
This would probably require a change in how the internal transform streams work.

Rename the method streamRows to eachRow

To avoid confusion with the previous one.

This was referenced Nov 26, 2013
@jorgebay
Copy link
Owner Author

Currently, the Protocol stream is being piped to 2 destinations: FrameParser and FrameStreamingParser, this causes that streamIds needs to be synchronized and parsing is done in 2 places.

I propose the following stream pipe:

 Socket        (transform stream)
   |
   |   chunks
   ↓
 Protocol      (transform stream)
   |
   |    header + body chunks
   ↓
 Parser        (transform stream)
   |
   |    header + (row | error)
   ↓
 ResultEmitter  (writable stream)

ResultEmitter emits the following events:

  • result
  • row: In case is yielding for each
  • responseEnd: when the parsing of a frame finished.

@ghost ghost assigned jorgebay Nov 27, 2013
@jorgebay
Copy link
Owner Author

Now, the Protocol, Parser and ResultEmitter work like explained above.

@bitcloud
Copy link
Contributor

great work!

jorgebay added a commit that referenced this issue Dec 18, 2013
- Used readableState.reading flag for the ResultStream
- Test ResultStream in object mode
- Added unit test for connection.stream
jorgebay added a commit that referenced this issue Jan 8, 2014
- set parser options only when the ExecuteWriter is being used
jorgebay added a commit that referenced this issue Jan 9, 2014
- Added more test for client.stream
- Bumped version to 0.4
@jorgebay
Copy link
Owner Author

jorgebay commented Jan 9, 2014

Implemented on master branch.
Thanks to @bitcloud for all the help!

@jorgebay jorgebay closed this as completed Jan 9, 2014
@bitcloud
Copy link
Contributor

bitcloud commented Jan 9, 2014

You are very welcome.
Thanks for the great driver @jorgebay!

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

No branches or pull requests

2 participants