-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE-2212] Cluster scope process function caches #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/7.0.0-rev9
Are you sure you want to change the base?
Changes from all commits
a002636
e6e8dac
6e09ba1
790659b
dd80913
7dc7947
eb56f99
93921f9
cf3dc8c
fc76808
b5bd5b5
9059bec
dfd7afd
e8441cb
0c1c914
53fb4e6
1cdfbc4
47ba662
7e0c9b8
4670f33
cf0651a
48e1411
b30c884
d7705b2
2654b7d
d457145
61f9b2e
289de0f
e9ef494
2274d62
39da22c
d82fc67
174c7ee
faa99d7
44c6ed7
fc637ee
6d84f5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,9 +27,14 @@ public class CacheConfigurationProperties { | |
| private String petriNetByIdentifier = "petriNetByIdentifier"; | ||
|
|
||
| /** | ||
| * Default cache name for caching the newest versions of Petri nets. | ||
| * Default cache name for caching the active versions of Petri nets. | ||
| */ | ||
| private String petriNetNewest = "petriNetNewest"; | ||
| private String petriNetActive = "petriNetActive"; | ||
|
|
||
| /** | ||
| * Default cache name for caching the latest versions of Petri nets. | ||
| */ | ||
| private String petriNetLatest = "petriNetLatest"; | ||
|
|
||
| /** | ||
| * Default cache name for general Petri net caching. | ||
|
|
@@ -41,6 +46,11 @@ public class CacheConfigurationProperties { | |
| */ | ||
| private String loadedModules = "loadedModules"; | ||
|
|
||
| /** | ||
| * Default cache name for caching namespace functions. | ||
| */ | ||
| private String globalFunctions = "globalFunctions"; | ||
|
Comment on lines
+49
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Clarify the comment to reflect the global scope. The comment describes "caching namespace functions" while the field is named 🤖 Prompt for AI Agents |
||
|
|
||
| /** | ||
| * A list of additional custom cache names. | ||
| * Allows users to define their own cache names for specific use cases. | ||
|
|
@@ -54,7 +64,8 @@ public class CacheConfigurationProperties { | |
| * @return a {@link Set} of all cache names. | ||
| */ | ||
| public Set<String> getAllCaches() { | ||
| Set<String> caches = new LinkedHashSet<>(Arrays.asList(petriNetById, petriNetByIdentifier, petriNetNewest, petriNetCache, loadedModules)); | ||
| Set<String> caches = new LinkedHashSet<>(Arrays.asList(petriNetById, petriNetByIdentifier, petriNetActive, | ||
| petriNetLatest, petriNetCache, loadedModules, globalFunctions)); | ||
| caches.addAll(additional); | ||
| return caches; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,7 +56,7 @@ public static class FieldRunnerProperties { | |||||||||||||
| /** | ||||||||||||||
| * The size of the cache used for maintaining field runner namespaces. | ||||||||||||||
| */ | ||||||||||||||
|
Comment on lines
56
to
58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the JavaDoc comment to reflect the global functions cache. The comment still references "maintaining field runner namespaces" but the property has been renamed to Apply this diff to update the comment: - /**
- * The size of the cache used for maintaining field runner namespaces.
- */
+ /**
+ * The size of the cache used for managing global Petri net namespace functions.
+ */📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dominikvozr please update the java doc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||
| private int namespaceCacheSize = 500; | ||||||||||||||
| private int globalFunctionsCacheSize = 500; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| package com.netgrif.application.engine.importer.service; | ||
|
|
||
| import com.netgrif.application.engine.objects.importer.model.Scope; | ||
| import com.netgrif.application.engine.objects.petrinet.domain.Function; | ||
| import com.netgrif.application.engine.objects.petrinet.domain.FunctionScope; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
@@ -9,7 +10,10 @@ | |
| @Slf4j | ||
| public final class FunctionFactory { | ||
|
|
||
| private static final String NAMESPACE = "namespace"; | ||
|
|
||
| public Function getFunction(com.netgrif.application.engine.objects.importer.model.Function function) { | ||
| checkDeprecatedAttributes(function); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For deprecated attributes we already use interface |
||
| Function function1 = new Function(); | ||
|
|
||
| function1.setDefinition(function.getValue()); | ||
|
|
@@ -18,4 +22,11 @@ public Function getFunction(com.netgrif.application.engine.objects.importer.mode | |
|
|
||
| return function1; | ||
| } | ||
|
|
||
| private void checkDeprecatedAttributes(com.netgrif.application.engine.objects.importer.model.Function function) { | ||
| if (function.getScope() != null && function.getScope().value().equals(NAMESPACE)) { | ||
| log.warn("Function scope [NAMESPACE] is deprecated. Replacing with [GLOBAL].]"); | ||
| function.setScope(Scope.GLOBAL); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,15 @@ public interface PetriNetRepository extends MongoRepository<PetriNet, String>, Q | |
| */ | ||
| PetriNet findByIdentifierAndVersion(String identifier, Version version); | ||
|
|
||
| /** | ||
| * Finds a {@link PetriNet} entity by its identifier and versionActive attribute | ||
| * | ||
| * @param identifier the unique identifier of the PetriNet. | ||
| * @param versionActive if true, the active version will be found, otherwise the inactive version | ||
| * @return the {@link PetriNet} entity matching the given identifier and versionActive attribute, or {@code null} if none found. | ||
| */ | ||
| PetriNet findByIdentifierAndVersionActive(String identifier, boolean versionActive); | ||
|
Comment on lines
+36
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for how findByIdentifierAndVersionActive is used
echo "=== Usage of findByIdentifierAndVersionActive ==="
rg -n "findByIdentifierAndVersionActive" --type java -B 2 -A 5
echo -e "\n=== PetriNet entity definition ==="
fd "PetriNet.java" --type f | head -1 | xargs cat | head -200
echo -e "\n=== Database constraints or schema annotations ==="
fd "PetriNet.java" --type f | head -1 | xargs rg -n "@.*Unique|@.*Constraint|@.*Index" | head -20
echo -e "\n=== How versionActive is defined ==="
fd "PetriNet.java" --type f | head -1 | xargs rg -n "versionActive" -B 2 -A 2 | head -50Repository: netgrif/application-engine Length of output: 3009 🏁 Script executed: #!/bin/bash
# Find the actual PetriNet entity (not SearchPetriNet)
echo "=== Finding PetriNet entity ==="
fd "PetriNet\.java" -x sh -c 'wc -l {} && echo "File: {}"' | sort -rn | head -20
echo -e "\n=== PetriNet entity with @Entity annotation ==="
fd "\.java" -x grep -l "class PetriNet" | grep -v Search | head -5
echo -e "\n=== Searching for PetriNet class definition ==="
rg "class PetriNet" --type java -A 100 | head -150
echo -e "\n=== Looking for unique constraints ==="
rg "UniqueConstraint|@Index.*unique|@Unique" -B 2 -A 2 --type java | grep -A 5 -B 5 PetriNet | head -50Repository: netgrif/application-engine Length of output: 24594 🏁 Script executed: #!/bin/bash
# Read the actual PetriNet entity
echo "=== PetriNet Entity Definition ==="
head -300 "./nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java"
echo -e "\n=== Searching for constraints and versionActive ==="
grep -n "@\|versionActive\|UniqueConstraint\|@Index" "./nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java" | head -60Repository: netgrif/application-engine Length of output: 11098 Implement the planned compound index for identifier and version uniqueness. The TODO comment on line 34 indicates this is a known limitation: a compound unique constraint on |
||
|
|
||
| /** | ||
| * Finds a paginated list of {@link PetriNet} entities by their identifier. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 2263
🏁 Script executed:
rg "petriNetNewest" --type javaRepository: netgrif/application-engine
Length of output: 178
🏁 Script executed:
rg -i "migration" application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/ --type javaRepository: netgrif/application-engine
Length of output: 52
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 234
🏁 Script executed:
rg "petriNetNewest|cache|breaking" ./application-engine/CHANGELOG.md -A 2 -B 2Repository: netgrif/application-engine
Length of output: 1241
🏁 Script executed:
rg "@Deprecated" application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/CacheConfigurationProperties.javaRepository: netgrif/application-engine
Length of output: 52
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 127
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 50383
🏁 Script executed:
rg "petriNetNewest" application-engine/src/main --type java -B 2 -A 2Repository: netgrif/application-engine
Length of output: 581
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 140
Document the breaking change for users overriding
petriNetNewest.The removal of
petriNetNewest(replaced bypetriNetActiveandpetriNetLatest) is a breaking change for users who have customized this property in their configuration files. Ensure that migration documentation is provided to guide users in updating their configurations, or consider adding a deprecatedpetriNetNewestproperty temporarily with a warning that maps to one of the new properties.🤖 Prompt for AI Agents