You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm aware that request is no a real stream, just an event emitter. It would be very advantageous if request streamed. I've seen it thrown around in a couple threads here that streaming is somewhat planned, like a nice to have just no time to do it.
So, first, is there any solid idea on when that time might come?
Second, i'm willing to do it, I'm just totally unfamiliar with the codebase. So if you guys are down to have another body in the code, could i get some cheat codes on where to start looking to implement this feature?
please inform either way, a lack of streams is making me throw things at the wall ;) i'd like to help
As far as time frame, there is none. Everyone wants this to happen; it just isn't a priority for anyone right now. If it's a priority for you, you're likely going to be more motivated to get it done than any of the maintainers. Speaking for myself and @rossipedia, our priorities have been to fix bugs and implement missing features we need (bulk insert, SQL Server Availability Groups), not performance. I believe when would eventually get around to this, but I don't know when.
I think the way to learn the codebase is to dive in. I haven't really given a ton of thought on how streams could be integrated, but as a primer:
The token-stream-parser reads from the TDS stream in the nextToken() method, which calls the token parsers. In particular, the one you probably care about most is the row-token-parser which returns a row event when it's done, which is emitted by the token-stream-parser. The connection listens for that event on the token-stream-parser and re-emits it on the request object here. So, the minimum streams implementation would convert that path to a stream instead of an event. I have a feeling that's going to have other implications though, too. Changes like that may be the threshold for version 2.0 of the library.
Make sure to talk often about how you're going about the implementation so we can discuss the impacts before it gets out of control, and make sure it's something we'll accept.
I think it's probably the best approach to emit events for metadata (such as login events and column metadata and such), and save the Readable streams for actual record data (with objectMode set).
A Transform stream operating on the TDS buffers is probably the best approach (disclaimer: I have not done a ton of work with NodeJS streams, so apologies if I have things completely wrong).
Activity
bretcope commentedon Sep 10, 2014
As far as time frame, there is none. Everyone wants this to happen; it just isn't a priority for anyone right now. If it's a priority for you, you're likely going to be more motivated to get it done than any of the maintainers. Speaking for myself and @rossipedia, our priorities have been to fix bugs and implement missing features we need (bulk insert, SQL Server Availability Groups), not performance. I believe when would eventually get around to this, but I don't know when.
I think the way to learn the codebase is to dive in. I haven't really given a ton of thought on how streams could be integrated, but as a primer:
The token-stream-parser reads from the TDS stream in the nextToken() method, which calls the token parsers. In particular, the one you probably care about most is the row-token-parser which returns a
rowevent when it's done, which is emitted by the token-stream-parser. The connection listens for that event on the token-stream-parser and re-emits it on the request object here. So, the minimum streams implementation would convert that path to a stream instead of an event. I have a feeling that's going to have other implications though, too. Changes like that may be the threshold for version2.0of the library.Make sure to talk often about how you're going about the implementation so we can discuss the impacts before it gets out of control, and make sure it's something we'll accept.
[-]streams[/-][+]Use Streams instead of Events[/+]bretcope commentedon Oct 3, 2014
There's nothing that stands out to me as wrong at first glance.
rossipedia commentedon Oct 5, 2014
I think it's probably the best approach to emit events for metadata (such as login events and column metadata and such), and save the
Readablestreams for actual record data (withobjectModeset).A
Transformstream operating on the TDS buffers is probably the best approach (disclaimer: I have not done a ton of work with NodeJS streams, so apologies if I have things completely wrong).bretcope commentedon Oct 6, 2014
Yeah, a transform on the stream is what we'd want.
bretcope commentedon Feb 20, 2015
Some work is being done on this #225
I'm closing this issue in favor of keeping progress updates on the PR.