[SERVER-71908] Simplify the Session read/write Interfaces to be sync/async agnostic Created: 06/Dec/22  Updated: 03/Aug/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matt Diener (Inactive) Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

As it stands today, both ingress and egress code paths use the same Session abstraction to implement their respective sides of sending or receiving commands. To accommodate this, the Session API provides 6 functions to enable sync and async interactions:

  • StatusWith<Message> sourceMessage()
  • Future<Message> asyncSourceMessage(const BatonHandle& handle)
  • Status waitForData()
  • Future<void> asyncWaitForData()
  • Status sinkMessage(Message message)
  • Future<void> asyncSinkMessage(Message message, const BatonHandle& handle)

 

Follow the pattern established by the refactor of the SessionWorkflow (formerly ServiceStateMachine) and use Future to provide an async-agnostic API to callers instead:

  • Future<Message> receiveMessage(PollingCoordinator& pc)
  • Future<void> sendMessage(PollingCoordinator& pc, const Message& msg)
  • Future<void> whenDataReady()


 Comments   
Comment by Matt Diener (Inactive) [ 27/Apr/23 ]

https://github.com/10gen/mongo/pull/12404 implements this. At the very least, it proves that the scope of this change is pretty small.

Generated at Thu Feb 08 06:20:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.