Unify message creation for OP_REPLY and OP_COMMANDREPLY messages

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Networking
    • None
    • Fully Compatible
    • Platform 8 08/28/15, Platform 7 08/10/15
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The Issue

      Currently replies to the find and getMore commands and queries in mongod and mongos explicitly construct the respond message. This gives flexibility in enforcing size restrictions and managing memory but is error prone, not flexible and can not support multiple output formats required for different wired versions.

      The Goal

      • Provide a uniform approach to constructing all messages that are sent out
        as an OP_REPLY or OP_COMMANDREPLY.
      • Implement run time transformation of the message to any version of the output wired protocol.

      Proposed Implementation

      Refactor existing ReplyBuilderInterface and derived classes.
      Add a new class

      template <class SizePolicy>
      class ReplyMessage: private SizePolicy {
      

      that will be used to construct a message. Its a policy host that can be customized with different policy for size checks, initial buffer size, and
      other properties known at the compile time.

      Refactor ReplyBuilderInterface for building the reply of the desired type from ReplyMessage.

      The intended usage is

      // build a message
      ReplyMessage<SizeCheckingPolicy> reply;
      ...
      reply.addOutputDocument(doc);
      ...
      auto builder = rpc::makeReplyBuilder(protocol);
      auto message = builder->build(reply);
      

            Assignee:
            Misha Tyulenev (Inactive)
            Reporter:
            Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: