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

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

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.0
    • Affects Version/s: None
    • Component/s: Internal
    • None

      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).

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

              Created:
              Updated:
              Resolved: