Reduce anchor lookups related to PrefixResolver (CPS-2417 #1) 84/138984/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Tue, 17 Sep 2024 19:50:29 +0000 (20:50 +0100)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 24 Sep 2024 09:48:42 +0000 (10:48 +0100)
commitad021691bb5296f203ddeaba41241d8ca1317414
tree0d54a47ae33d284078bc31238e0f31d4155fb0f9
parent06391e2c0b13064caa643bd9f44e773eaeeb2631
Reduce anchor lookups related to PrefixResolver (CPS-2417 #1)

Instead of looking up same Anchor many times inside a for-loop,
do it once outside the loop.

This greatly improves performance in some cases, such as v2 GET API:
- /cps/api/v2/dataspaces/{dataspace}/anchors/{anchor}/node
Testing shows 3x faster response time.

Issue-ID: CPS-2417
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I80d97d8cc24372eed70626ed840cad985cbe0a4b
cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java
cps-rest/src/main/java/org/onap/cps/rest/controller/QueryRestController.java
cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy