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

Add a future_util::whenAnyThat

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Service Arch 2022-08-08, Service Arch 2022-08-22

    Description

      Right now, we have a helper function future_util::whenAny that takes as argument a vector of Future<T> and returns a SemiFuture that resolves when the first of the input futures resolves along with its index in the input vector.

      This function is useful but doesn't allow for any selectivity about how the input futures resolve. For example, we might want a future that resolves when any of the input futures resolve with success, i.e. whenAnySucceeds. To allow for that sort of selectivity, add a whenAnyThat helper that takes a predicate to evaluate against each result of the input futures and only resolves the output future when either:

      -> one of the input futures resolves with a result that satisfies the predicate

      -> all of the input futures resolve

      Attachments

        Activity

          People

            erin.mcnulty@mongodb.com Erin McNulty
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: