use of com.eightkdata.mongowp.server.api.oplog.CollectionOplogOperation in project torodb by torodb.
the class BatchAnalyzer method apply.
@Override
public List<AnalyzedOplogBatch> apply(List<OplogOperation> oplogOps) {
List<AnalyzedOplogBatch> result = new ArrayList<>();
int fromExcluded = -1;
for (int i = 0; i < oplogOps.size(); i++) {
OplogOperation op = oplogOps.get(i);
switch(op.getType()) {
case DB:
case NOOP:
LOGGER.debug("Ignoring operation {}", op);
break;
case DB_CMD:
addParallelToBatch(oplogOps, fromExcluded, i, result);
fromExcluded = i;
result.add(new SingleOpAnalyzedOplogBatch((DbCmdOplogOperation) op));
break;
case DELETE:
case INSERT:
case UPDATE:
{
//CUD operations on system collection must be addressed sequentially
if (SYSTEM_COLLECTIONS.contains(((CollectionOplogOperation) op).getCollection())) {
addParallelToBatch(oplogOps, fromExcluded, i, result);
fromExcluded = i;
result.add(new SingleOpAnalyzedOplogBatch(op));
}
break;
}
default:
throw new AssertionError("Found an unknown oplog operation " + op);
}
}
addParallelToBatch(oplogOps, fromExcluded, oplogOps.size(), result);
return result;
}
Aggregations