Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-19451

Unify message creation for OP_REPLY and OP_COMMANDREPLY messages

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Networking
    • None
    • Fully Compatible
    • Platform 8 08/28/15, Platform 7 08/10/15

    Description

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

      Attachments

        Activity

          People

            misha.tyulenev@mongodb.com Misha Tyulenev
            misha.tyulenev@mongodb.com Misha Tyulenev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: