tengqm commented on code in PR #6129:
URL: https://github.com/apache/gravitino/pull/6129#discussion_r1906174477

##########
core/src/main/java/org/apache/gravitino/listener/api/info/ModelInfo.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.listener.api.info;
+
+import java.util.Map;
+import javax.annotation.Nullable;
+import lombok.Getter;
+import org.apache.gravitino.Audit;
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.model.Model;
+import org.apache.gravitino.model.ModelVersion;
+
+/**
+ * ModelInfo exposes model information for event listener, it's supposed to be 
read only. Most of
+ * the fields are shallow copied internally not deep copies for performance.
+ */
+@DeveloperApi
+public class ModelInfo {
+  @Getter private final String name;
+  @Nullable private final String comment;
+  @Getter private final Map<String, String> properties;
+  @Nullable private final Audit audit;
+  @Getter private final int lastVersion;
+  private final ModelVersion[] versions;
+
+  /**
+   * Constructs model information based on a given model.
+   *
+   * @param model the model to expose information for.
+   */
+  public ModelInfo(Model model) {
+    this(model, null);
+  }
+
+  /**
+   * Constructs model information based on a given model and model versions.
+   *
+   * @param model the model to expose information for.
+   * @param modelVersion the versions of the model.
+   */
+  public ModelInfo(Model model, ModelVersion[] modelVersion) {

Review Comment:
   ```suggestion
     public ModelInfo(Model model, ModelVersion[] modelVersions) {
   ```



##########
core/src/main/java/org/apache/gravitino/listener/api/event/GetModelVersionEvent.java:
##########
@@ -0,0 +1,61 @@
+/*
+ *  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.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.listener.api.info.ModelInfo;
+
+/** Represents an event triggered upon the successful getting the version of a 
model. */
+public class GetModelVersionEvent extends ModelEvent {
+  public final ModelInfo GetModelVersionInfo;
+
+  /**
+   * Constructs an instance of {@code GetModelVersionEvent}.
+   *
+   * @param user The username of the individual who initiated the get model 
version event.
+   * @param identifier The unique identifier of the model that was getting the 
version.
+   * @param getModelVersionInfo The state of the model after the version was 
loaded.
+   */
+  public GetModelVersionEvent(
+      String user, NameIdentifier identifier, ModelInfo getModelVersionInfo) {
+    super(user, identifier);
+    GetModelVersionInfo = getModelVersionInfo;

Review Comment:
   ```suggestion
       this.info = getModelVersionInfo;
   ```



-- 
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: commits-unsubscr...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to