mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-13 22:58:54 +02:00
![twitter-team](/assets/img/avatar_default.png)
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
package com.twitter.search.earlybird_root.mergers;
|
|
|
|
import com.twitter.search.earlybird.thrift.EarlybirdResponse;
|
|
import com.twitter.search.earlybird.thrift.EarlybirdResponseCode;
|
|
|
|
|
|
public final class PartitionResponseAccumulator extends ResponseAccumulator {
|
|
private static final String TARGET_TYPE_PARTITION = "partition";
|
|
|
|
@Override
|
|
public String getNameForLogging(int responseIndex, int numTotalResponses) {
|
|
return TARGET_TYPE_PARTITION + responseIndex;
|
|
}
|
|
|
|
@Override
|
|
public String getNameForEarlybirdResponseCodeStats(int responseIndex, int numTotalResponses) {
|
|
// We do not need to differentiate between partitions: we just want to get the number of
|
|
// responses returned by Earlybirds, for each EarlybirdResponseCode.
|
|
return TARGET_TYPE_PARTITION;
|
|
}
|
|
|
|
@Override
|
|
boolean shouldEarlyTerminateMerge(EarlyTerminateTierMergePredicate merger) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void handleSkippedResponse(EarlybirdResponseCode responseCode) { }
|
|
|
|
@Override
|
|
public void handleErrorResponse(EarlybirdResponse response) {
|
|
}
|
|
|
|
@Override
|
|
public AccumulatedResponses.PartitionCounts getPartitionCounts() {
|
|
return new AccumulatedResponses.PartitionCounts(getNumResponses(),
|
|
getSuccessResponses().size() + getSuccessfulEmptyResponseCount(), null);
|
|
}
|
|
|
|
@Override
|
|
protected boolean isMergingAcrossTiers() {
|
|
return false;
|
|
}
|
|
}
|