Implement Pluggable OS Adapter

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 3
    • Not Needed
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      As a Developer
      I want the driver to use my injected os adapter.
      So that I can collect client metadata in environments without a native Node.js os module.

      User Experience

      • Driver uses provided os adapter instead of require('os').

      Acceptance Criteria

      Implementation Requirements

      • API Update: MongoClientOptions interface includes an optional, experimental property:
        /** @experimental */
        driverAdapters?: {
          os?: OsAdapter;
        }
      • Resolution Logic:
        • At options parsing time, resolve the provided options with defaults (nodejs OS module)
        • Store the property in an accessible place on the MongoClient
      • No Breaking Changes: The default path must result in the exact same native Node.js modules being loaded.
      • Remove import: remove require('os') from all places inside src folder.
      • Use os adapter provided with the mongo client options.
      • Add `os` as a restricted eslint import

      Testing Requirements

        • Instantiate new MongoClient() (no options). Assert that client['runtime'].os is strictly equal to the native require('os') module.
        • Instantiate new MongoClient(..., { driverAdapters: { os: mockOs }}). Assert that client['runtime'].os equals mockOs.
      • ensure existing integration tests pass

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

            Assignee:
            Bailey Pearson
            Reporter:
            Sergey Zelenov
            Pavel Safronov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: