Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2729

Refactor CRUD API implementations to reduce API surface exposure in driver-core

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.0
    • Component/s: Internal
    • Labels:
      None

      Description

      We already have two CRUD API implementations, and may soon add a third, that proxy to instances of ReadOperation/WriteOperation or AsyncReadOperation/AsyncWriteOperation. Two problem that causes:

      • There is duplicated code in the two implementations (for example, in converting from WriteModel to WriteRequest)
      • There is unnecessary exposure to the concrete implementations of the operation interfaces (e.g. FindOperation, MixedBulkWriteOperation)

      Address this technical debt by:

      • Creating in core a SyncOperations and an AsyncOperations class, whose methods take the same parameters as the CRUD API but return instances, respectively of ReadOperation/WriteOperation and AsyncReadOperation/AsyncWriteOperation. These are both implemented in terms of a package-private Operations class that has the same methods, but which return instances of the concrete operation types. SyncOperations and AsyncOperations are in com.mongodb.internal currently, so are not considered part of the public API.
      • Re-implementing the sync and async CRUD API (MongoCollection and MongoIterable subclasses) in terms of SyncOperations (for the sync API) and AsyncOperations (for the async API).

        Attachments

          Activity

            People

            Assignee:
            jeff.yemin Jeffrey Yemin
            Reporter:
            jeff.yemin Jeffrey Yemin
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: