Skip to content

Commit 29fd0a8

Browse files
author
mpv1989
committed
Add AqlQueryOptions#shardIds (internal option)
1 parent 606558b commit 29fd0a8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/main/java/com/arangodb/model/AqlQueryOptions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.arangodb.model;
2222

23+
import java.util.ArrayList;
24+
import java.util.Arrays;
2325
import java.util.Collection;
2426

2527
import com.arangodb.velocypack.VPackSlice;
@@ -370,6 +372,21 @@ public AqlQueryOptions stream(final Boolean stream) {
370372
return this;
371373
}
372374

375+
public Collection<String> getShardIds() {
376+
return options != null ? options.shardIds : null;
377+
}
378+
379+
/**
380+
* Restrict query to shards by given ids. This is an internal option. Use at your own risk.
381+
*
382+
* @param shardIds
383+
* @return options
384+
*/
385+
public AqlQueryOptions shardIds(final String... shardIds) {
386+
getOptions().getShardIds().addAll(Arrays.asList(shardIds));
387+
return this;
388+
}
389+
373390
private Options getOptions() {
374391
if (options == null) {
375392
options = new Options();
@@ -390,6 +407,7 @@ private static class Options {
390407
private Boolean fullCount;
391408
private Integer maxPlans;
392409
private Boolean stream;
410+
private Collection<String> shardIds;
393411

394412
protected Optimizer getOptimizer() {
395413
if (optimizer == null) {
@@ -398,6 +416,13 @@ protected Optimizer getOptimizer() {
398416
return optimizer;
399417
}
400418

419+
protected Collection<String> getShardIds() {
420+
if (shardIds == null) {
421+
shardIds = new ArrayList<String>();
422+
}
423+
return shardIds;
424+
}
425+
401426
}
402427

403428
private static class Optimizer {

0 commit comments

Comments
 (0)