cshannon commented on code in PR #4563:
URL: https://github.com/apache/accumulo/pull/4563#discussion_r1605459236
##########
core/src/main/java/org/apache/accumulo/core/fate/FateId.java:
##########
@@ -36,11 +38,16 @@ public class FateId extends AbstractId<FateId> {
private static final long serialVersionUID = 1L;
private static final String PREFIX = "FATE:";
- private static final String UUID_REGEX =
"[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}";
- private static final Pattern UUID_PATTERN = Pattern.compile("^" + UUID_REGEX
+ "$");
- private static final Pattern FATEID_PATTERN = Pattern.compile("^" + PREFIX +
"("
- +
Stream.of(FateInstanceType.values()).map(Enum::name).collect(Collectors.joining("|"))
+ "):"
- + UUID_REGEX + "$");
+
+ private static final String META_PREFIX = FateInstanceType.META.name() + ":";
+ private static final String USER_PREFIX = FateInstanceType.USER.name() + ":";
+
+ static {
+ // Validate the assumptions made by this class
+ Preconditions.checkState(Set.of(FateInstanceType.values())
Review Comment:
These are really good checks to prevent mistakes in the future with changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]