Created
June 27, 2018 23:11
-
-
Save varokas/23b2ebde620aee0d681fb62988a26245 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final Map<Long, PartitionResult> getPartitionsForUsersPrivate(List<Long> dsids) | |
throws AccountAPIException { | |
BatchLookupPartitionRequest batchLookupPartitionRequest = new BatchLookupPartitionRequest(); | |
for (Long dsid : dsids) { | |
batchLookupPartitionRequest.addDsidServiceTypePair(dsid, ServiceType.CloudDB); | |
} | |
BatchPartitionResponse batchPartitionResponse = | |
PartitionAssignmentAPIFactory.partitionAssignmentAPI().batchLookupDatastore( | |
batchLookupPartitionRequest); | |
Map<Long, PartitionResult> partitionAssignments = new HashMap<>(); | |
for (PartitionResponse partitionResponse : batchPartitionResponse.getPartitionResponses()) { | |
if (partitionResponse.isSuccess()) { | |
DatastoreAssignment assignment = partitionResponse.getPartitionAssignment(); | |
if (assignment != null) { | |
partitionAssignments.put(assignment.getDsid(), | |
PartitionResult.createSuccess(assignment.getAssignedPartitionId(), Method.LOOKUP)); | |
} else { | |
log.warn(new SplunkMessage( | |
"PartitionLookup: PartitionResponse with a success with no assignment", | |
"statusCode", partitionResponse.getStatus(), | |
"errorMsg", partitionResponse.getError())); | |
} | |
} else { | |
log.info(new SplunkMessage("PartitionLookup: PartitionResponse failure", | |
"statusCode", partitionResponse.getStatus(), | |
"errorMsg", partitionResponse.getError())); | |
} | |
} | |
return partitionAssignments; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment