@@ -57,6 +57,7 @@ public final class SplittablePayload {
57
57
private final WriteRequestEncoder writeRequestEncoder = new WriteRequestEncoder ();
58
58
private final Type payloadType ;
59
59
private final List <WriteRequestWithIndex > writeRequestWithIndexes ;
60
+ private final boolean ordered ;
60
61
private final Map <Integer , BsonValue > insertedIds = new HashMap <>();
61
62
private int position = 0 ;
62
63
@@ -91,9 +92,10 @@ public enum Type {
91
92
* @param payloadType the payload type
92
93
* @param writeRequestWithIndexes the writeRequests
93
94
*/
94
- public SplittablePayload (final Type payloadType , final List <WriteRequestWithIndex > writeRequestWithIndexes ) {
95
+ public SplittablePayload (final Type payloadType , final List <WriteRequestWithIndex > writeRequestWithIndexes , final boolean ordered ) {
95
96
this .payloadType = notNull ("batchType" , payloadType );
96
97
this .writeRequestWithIndexes = notNull ("writeRequests" , writeRequestWithIndexes );
98
+ this .ordered = ordered ;
97
99
}
98
100
99
101
/**
@@ -159,13 +161,17 @@ public boolean hasAnotherSplit() {
159
161
return writeRequestWithIndexes .size () > position ;
160
162
}
161
163
164
+ boolean isOrdered () {
165
+ return ordered ;
166
+ }
167
+
162
168
/**
163
169
* @return a new SplittablePayload containing only the values after the current position.
164
170
*/
165
171
public SplittablePayload getNextSplit () {
166
172
isTrue ("hasAnotherSplit" , hasAnotherSplit ());
167
173
List <WriteRequestWithIndex > nextPayLoad = writeRequestWithIndexes .subList (position , writeRequestWithIndexes .size ());
168
- return new SplittablePayload (payloadType , nextPayLoad );
174
+ return new SplittablePayload (payloadType , nextPayLoad , ordered );
169
175
}
170
176
171
177
/**
0 commit comments