aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
index f088db31c23..baf7dcb0f68 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
@@ -30,6 +30,7 @@ import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.metrics.simple.MetricReceiver;
import com.yahoo.text.Text;
import com.yahoo.vespa.config.content.LoadTypeConfig;
+import com.yahoo.vespa.config.content.core.AllClustersBucketSpacesConfig;
import com.yahoo.vespaclient.ClusterDef;
import com.yahoo.vespaclient.ClusterList;
import com.yahoo.vespaxmlparser.VespaXMLFeedReader;
@@ -75,6 +76,7 @@ public class RestApi extends LoggingRequestHandler {
@Inject
public RestApi(LoggingRequestHandler.Context parentCtx, DocumentmanagerConfig documentManagerConfig,
LoadTypeConfig loadTypeConfig, ThreadpoolConfig threadpoolConfig,
+ AllClustersBucketSpacesConfig bucketSpacesConfig,
ClusterListConfig clusterListConfig, MetricReceiver metricReceiver)
{
super(parentCtx);
@@ -83,6 +85,7 @@ public class RestApi extends LoggingRequestHandler {
this.operationHandler = new OperationHandlerImpl(
new MessageBusDocumentAccess(params),
fixedClusterEnumeratorFromConfig(clusterListConfig),
+ fixedBucketSpaceResolverFromConfig(bucketSpacesConfig),
metricReceiver);
this.singleDocumentParser = new SingleDocumentParser(new DocumentTypeManager(documentManagerConfig));
// 40% of the threads can be blocked before we deny requests.
@@ -120,6 +123,14 @@ public class RestApi extends LoggingRequestHandler {
return () -> clusters;
}
+ private static OperationHandlerImpl.BucketSpaceResolver fixedBucketSpaceResolverFromConfig(
+ AllClustersBucketSpacesConfig bucketSpacesConfig) {
+ return (clusterId, docType) ->
+ Optional.ofNullable(bucketSpacesConfig.cluster(clusterId))
+ .map(cluster -> cluster.documentType(docType))
+ .map(type -> type.bucketSpace());
+ }
+
private static Optional<String> requestProperty(String parameter, HttpRequest request) {
final String property = request.getProperty(parameter);
if (property != null && ! property.isEmpty()) {