Skip to content

Use Streams instead of Events #186

Closed

Description

@stephen-bartell

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

Activity

  1. bretcope commented on Sep 10, 2014

    @bretcope
    Member

    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.

  2. changed the title [-]streams[/-] [+]Use Streams instead of Events[/+] on Sep 29, 2014
  3. bretcope commented on Oct 3, 2014

    @bretcope
    Member

    There's nothing that stands out to me as wrong at first glance.

  4. rossipedia commented on Oct 5, 2014

    @rossipedia
    Contributor

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

  5. bretcope commented on Oct 6, 2014

    @bretcope
    Member

    Yeah, a transform on the stream is what we'd want.

  6. bretcope commented on Feb 20, 2015

    @bretcope
    Member

    Some work is being done on this #225

    I'm closing this issue in favor of keeping progress updates on the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions