Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.indexdata.reservoir.server;

import com.indexdata.reservoir.matchkey.MatchKeyMethod;
import com.indexdata.reservoir.module.ModuleExecutable;

public class IngestMatcher {
String matchKeyId;
ModuleExecutable moduleExecutable;
MatchKeyMethod matchKeyMethod;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.indexdata.reservoir.server;

import com.indexdata.reservoir.matchkey.MatchKeyMethodFactory;
import com.indexdata.reservoir.module.ModuleCache;
import com.indexdata.reservoir.module.ModuleInvocation;
import com.indexdata.reservoir.server.entity.CodeModuleEntity;
Expand Down Expand Up @@ -250,9 +249,6 @@ Future<Void> getCluster(RoutingContext ctx) {

static String getMethod(JsonObject config) {
String method = config.getString("method");
if (method != null && MatchKeyMethodFactory.get(method) == null) {
throw new IllegalArgumentException("Non-existing method '" + method + "'");
}
return method;
}

Expand Down Expand Up @@ -395,7 +391,7 @@ Future<Void> postCodeModule(RoutingContext ctx) {
.compose(res ->
HttpResponse.responseJson(ctx, 201)
.putHeader("Location", ctx.request().absoluteURI() + "/" + cm.getId())
.end(cm.asJson().encode())
.end(cm.asJson(true).encode())
)
);
}
Expand All @@ -410,7 +406,7 @@ Future<Void> getCodeModule(RoutingContext ctx) {
String.format(ENTITY_ID_NOT_FOUND_PATTERN, MODULE_LABEL, id));
return;
}
HttpResponse.responseJson(ctx, 200).end(e.asJson().encode());
HttpResponse.responseJson(ctx, 200).end(e.asJson(true).encode());
})
.mapEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.indexdata.reservoir.server;

import com.indexdata.reservoir.matchkey.MatchKeyMethod;
import com.indexdata.reservoir.module.ModuleCache;
import com.indexdata.reservoir.module.ModuleExecutable;
import com.indexdata.reservoir.module.ModuleInvocation;
Expand Down Expand Up @@ -362,14 +361,6 @@ Future<MatcherResult> runMatcher(IngestMatcher ingestMatcher, IngestMetrics inge
return result;
});
}
if (ingestMatcher.matchKeyMethod != null) {
HashSet<String> values = new HashSet<>();
ingestMatcher.matchKeyMethod.getKeys(payload, values);
values.forEach(k -> result.keys.add(k.length() > MATCHVALUE_MAX_LENGTH
? k.substring(0, MATCHVALUE_MAX_LENGTH) : k));

ingestMetrics.recordMatcher(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
}
return Future.succeededFuture(result);
}

Expand Down Expand Up @@ -403,16 +394,7 @@ Future<IngestMatcher> createIngestMatcher(JsonObject matchKeyConfig, Vertx vertx
});
});
}
String methodName = matchKeyConfig.getString("method");
if (methodName != null) {
JsonObject params = matchKeyConfig.getJsonObject("params");
return MatchKeyMethod.get(vertx, tenant, ingestMatcher.matchKeyId, methodName, params)
.compose(matchKeyMethod -> {
ingestMatcher.matchKeyMethod = matchKeyMethod;
return Future.succeededFuture(ingestMatcher);
});
}
return Future.failedFuture("match key config must include 'method' or 'matcher'");
return Future.failedFuture("match key config must include 'matcher'");
}

Future<List<IngestMatcher>> createIngestMatchers(JsonArray matchKeyConfigs, Vertx vertx) {
Expand Down
10 changes: 0 additions & 10 deletions server/src/main/resources/openapi/schemas/matchKey.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
"type": "string",
"description": "matcher module invocation: 'moduleId<::function>' where <::function> is optional"
},
"method": {
"type": "string",
"description": "DEPRECATED: use 'matcher' instead",
"deprecated": true
},
"params": {
"type": "object",
"description": "DEPRECATED: use 'matcher' instead",
"deprecated": true
},
"update": {
"type": "string",
"enum": ["ingest", "manual"],
Expand Down
Loading