Skip to content

Commit a18d207

Browse files
committed
Simplify Operations by uniting Sync and Async operations into a single interface.
Merged Async Read / Write Operations into their sync operations counterparts. * AsyncWriteOperation into WriteOperation is a simple merge * AsyncReadOperation into ReadOperation requires an additional type parameter This is due to async and sync cursors have different types. Added extra ReadOperations interfaces to represent: * Read operations that return the same type for sync / async * Read operations that represent cursors Removed SyncOperations and AsyncOperations builders which both use the same Operations builder class. JAVA-4900
1 parent a0173ff commit a18d207

File tree

78 files changed

+493
-1216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+493
-1216
lines changed

driver-core/src/main/com/mongodb/internal/operation/AbstractWriteSearchIndexOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
* <p>This class is not part of the public API and may be removed or changed at any time</p>
3939
*/
40-
abstract class AbstractWriteSearchIndexOperation implements AsyncWriteOperation<Void>, WriteOperation<Void> {
40+
abstract class AbstractWriteSearchIndexOperation implements WriteOperation<Void> {
4141
private final MongoNamespace namespace;
4242

4343
AbstractWriteSearchIndexOperation(final MongoNamespace namespace) {

driver-core/src/main/com/mongodb/internal/operation/AggregateOperation.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* <p>This class is not part of the public API and may be removed or changed at any time</p>
4343
*/
44-
public class AggregateOperation<T> implements AsyncExplainableReadOperation<AsyncBatchCursor<T>>, ExplainableReadOperation<BatchCursor<T>> {
44+
public class AggregateOperation<T> implements ReadOperationExplainable<T> {
4545
private final AggregateOperationImpl<T> wrapped;
4646

4747
public AggregateOperation(final MongoNamespace namespace, final List<BsonDocument> pipeline, final Decoder<T> decoder) {
@@ -151,13 +151,7 @@ public void executeAsync(final AsyncReadBinding binding, final SingleResultCallb
151151
}
152152

153153
@Override
154-
public <R> ReadOperation<R> asExplainableOperation(@Nullable final ExplainVerbosity verbosity, final Decoder<R> resultDecoder) {
155-
return createExplainableOperation(verbosity, resultDecoder);
156-
}
157-
158-
@Override
159-
public <R> AsyncReadOperation<R> asAsyncExplainableOperation(@Nullable final ExplainVerbosity verbosity,
160-
final Decoder<R> resultDecoder) {
154+
public <R> ReadOperationSimple<R> asExplainableOperation(@Nullable final ExplainVerbosity verbosity, final Decoder<R> resultDecoder) {
161155
return createExplainableOperation(verbosity, resultDecoder);
162156
}
163157

driver-core/src/main/com/mongodb/internal/operation/AggregateOperationImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import static com.mongodb.internal.operation.SyncOperationHelper.CommandReadTransformer;
5353
import static com.mongodb.internal.operation.SyncOperationHelper.executeRetryableRead;
5454

55-
class AggregateOperationImpl<T> implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>> {
55+
class AggregateOperationImpl<T> implements ReadOperationCursor<T> {
5656
private static final String COMMAND_NAME = "aggregate";
5757
private static final String RESULT = "result";
5858
private static final String CURSOR = "cursor";

driver-core/src/main/com/mongodb/internal/operation/AggregateToCollectionOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
*
5555
* <p>This class is not part of the public API and may be removed or changed at any time</p>
5656
*/
57-
public class AggregateToCollectionOperation implements ReadOperation<Void>, AsyncReadOperation<Void> {
57+
public class AggregateToCollectionOperation implements ReadOperationSimple<Void> {
5858
private static final String COMMAND_NAME = "aggregate";
5959
private final MongoNamespace namespace;
6060
private final List<BsonDocument> pipeline;

driver-core/src/main/com/mongodb/internal/operation/AsyncExplainableReadOperation.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)