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

Futurize ServiceEntryPoint::handleRequest()

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • Service arch 2020-06-29, Service arch 2020-07-13, Service Arch 2020-07-27, Service Arch 2020-08-10

      ServiceEntryPoint is the second piece of our command pathway after ServiceStateMachine. They meet here when handleRequest() is invoked. Let's convert that virtual function signature,

      DbResponse handleRequest(OperationContext* opCtx, const Message& request);

      will become

      Future<DbResponse> handleRequest(OperationContext* opCtx, const Message& request) noexcept;

      Futures can be made from their payload type (see here), so converting each overridden function for derived classes should be simple for now. The noexcept implies that no exception should ever leave handleRequest().

      Once we have that future in ServiceStateMachine::_processMessage(), we can take the post processing here as an onCompletion() callback and then call get() to synchronize the asynchronous execution on the local thread.

            Assignee:
            a.chen@mongodb.com Andrew Chen (Inactive)
            Reporter:
            ben.caimano@mongodb.com Benjamin Caimano (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: