Skip to content

Commit

Permalink
returning continuationOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
adibaba committed Jan 17, 2019
1 parent 4335e4f commit 23fedea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public Map<String, Float> compute(URI dataset, Collection<String> metricIds) {
* process all results.
* @param limit Number of items per request
* @param metricIds a collection of metrics to compute
*
* @return Offset for continuation
*/
public void compute(int offset, int endOffset, int limit, Collection<String> metricIds) {
public int compute(int offset, int endOffset, int limit, Collection<String> metricIds) {

// Get required data object IDs
Set<String> dataObjectIds = getDataobjectIds(metricIds);
Expand Down Expand Up @@ -117,6 +119,8 @@ public void compute(int offset, int endOffset, int limit, Collection<String> met
loopOffset = newLoopOffset;
}
}

return loopOffset;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public void testMultipleDatasets() {
int offset = 0;
int endOffset = 100;
int limit = 40;
int processedDatasets = orchestration.compute(offset, endOffset, limit, metrics);
assumeTrue(endOffset < processedDatasets);
int continuationOffset = orchestration.compute(offset, endOffset, limit, metrics);
assumeTrue(endOffset < continuationOffset);
}

/**
Expand Down

0 comments on commit 23fedea

Please sign in to comment.