jerryshao commented on code in PR #7037:
URL: https://github.com/apache/gravitino/pull/7037#discussion_r2077082265
##########
api/src/main/java/org/apache/gravitino/model/ModelVersionChange.java:
##########
@@ -327,4 +353,94 @@ public String toString() {
return "UpdateUri " + newUri;
}
}
+
+ /**
+ * Represents an update to a model version’s aliases, specifying which
aliases to add and which to
+ * remove.
+ *
+ * <p>Both alias sets are stored as immutable.
+ */
+ final class UpdateAliases implements ModelVersionChange {
+ private final ImmutableSortedSet<String> aliasesToAdd;
+ private final ImmutableSortedSet<String> aliasesToDelete;
+
+ /**
+ * Constructs a new aliases-update operation.
+ *
+ * @param aliasesToAdd the aliases to add, or null for none
+ * @param aliasesToDelete the aliases to remove, or null for none
+ */
+ public UpdateAliases(List<String> aliasesToAdd, List<String>
aliasesToDelete) {
+ Set<String> toAdd =
+ Sets.newHashSet(aliasesToAdd != null ? aliasesToAdd :
Collections.emptyList());
+ Set<String> toDelete =
+ Sets.newHashSet(aliasesToDelete != null ? aliasesToDelete :
Collections.emptyList());
+
+ this.aliasesToAdd = ImmutableSortedSet.copyOf(Sets.difference(toAdd,
toDelete));
+ this.aliasesToDelete =
ImmutableSortedSet.copyOf(Sets.difference(toDelete, toAdd));
Review Comment:
We should do the dedup in the server side, not in the client side, otherwise
there's still issues for the REST APIs.
--
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]