roryqi commented on code in PR #13801: URL: https://github.com/apache/gravitino/pull/13801#discussion_r4278240252
########## api/src/main/java/org/apache/gravitino/policy/PolicyExecutionSpec.java: ########## @@ -0,0 +1,181 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.gravitino.policy; + +import java.util.Map; +import java.util.Objects; +import javax.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; + +/** + * Immutable execution peer fields for executable policy contents: triggers, cooldown, and option + * bags. + * + * <p>JSON property names remain the flat peer keys on policy content ({@code timeTrigger}, {@code + * commitTrigger}, {@code minIntervalMs}, {@code jobOptions}, {@code updateOptions}). This type is + * the in-memory composition for {@link ExecutablePolicyContent}. + */ +public final class PolicyExecutionSpec { + + /** Spec with every peer unset. */ + public static final PolicyExecutionSpec EMPTY = + new PolicyExecutionSpec(null, null, null, null, null); + + @Nullable private final String timeTrigger; + @Nullable private final Boolean commitTrigger; + @Nullable private final Long minIntervalMs; + private final Map<String, String> jobOptions; + private final Map<String, String> updateOptions; + + private PolicyExecutionSpec( Review Comment: `PolicyExecutionSpec` is now serialized as the `executionSpec` field of every executable policy content, but this type has only a private constructor and no Jackson creator/default constructor. `POConverters.fromPolicyPO()` therefore cannot read the stored content back; the current `:core:test` and Maintenance IT failures both report `Cannot construct instance of PolicyExecutionSpec`. Please make the persisted form deserializable (for example with an appropriate `@JsonCreator`/property mapping or a custom persistence representation) and add a `POConverters` round-trip test for maintenance policy content. -- 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]
