Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1786

Refactor wire protocol's command method to take a callback

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.11
    • Affects Version/s: None
    • Component/s: None
    • None

      The WireProtocol.prototype.command method is the current odd duck out in the methods provided on the wire protocol handler, in that it actually just prepares a command, rather than executing it. This is done primarily for cursors, since they build the command and save it off internally. Refactoring this method to take a command accomplishes a few things:

      • Makes the API for this class consistent, allowing for easy refactoring of the actual code - or even allowing the code to be moves to another location (perhaps directly on Connection, so we can move server selection elsewhere
      • Allows locations in the code that are building their own Query instances to reuse the command method, so that we can reduce the number of places we have to make wire protocol based decisions (is collation supported?) 
      • Once all locations in the code are using this path, we can easily switch between OP_QUERY and OP_MSG, satisfying the full implementation of OP_MSG

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            matt.broadstone@mongodb.com Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: