forked from apache/gravitino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[apache#6078] feat(core): Support model event to Gravitino server
Fix some error and add ModelEventDispatcher to Gravitino server.
- Loading branch information
1 parent
cfcdb83
commit b0c8321
Showing
10 changed files
with
874 additions
and
54 deletions.
There are no files selected for viewing
400 changes: 400 additions & 0 deletions
400
core/src/main/java/org/apache/gravitino/listener/ModelEventDispatcher.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
core/src/main/java/org/apache/gravitino/listener/api/info/ModelVersionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* 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.model.ModelVersion; | ||
|
||
/** | ||
* {@link ModelVersionInfo} exposes model version information for event listener, it's supposed to | ||
* be read only. Most of the fields are shallow copied internally not deep copies for performance. | ||
*/ | ||
public class ModelVersionInfo { | ||
@Getter private final String uri; | ||
@Getter @Nullable private final String[] aliases; | ||
@Nullable private final String comment; | ||
@Getter private final Map<String, String> properties; | ||
@Nullable private final Audit auditInfo; | ||
|
||
/** | ||
* Constructs model version information based on a given {@link ModelVersion}. | ||
* | ||
* @param modelVersion the model version to expose information for. | ||
*/ | ||
public ModelVersionInfo(ModelVersion modelVersion) { | ||
this.uri = modelVersion.uri(); | ||
this.aliases = modelVersion.aliases(); | ||
this.comment = modelVersion.comment(); | ||
this.properties = modelVersion.properties(); | ||
this.auditInfo = modelVersion.auditInfo(); | ||
} | ||
|
||
/** | ||
* Constructs model version information based on a given arguments. | ||
* | ||
* @param uri | ||
* @param aliases | ||
* @param comment | ||
* @param properties | ||
*/ | ||
public ModelVersionInfo( | ||
String uri, String[] aliases, String comment, Map<String, String> properties) { | ||
this.uri = uri; | ||
this.aliases = aliases; | ||
this.comment = comment; | ||
this.properties = properties; | ||
this.auditInfo = null; | ||
} | ||
|
||
/** | ||
* Returns the comment of the model version. | ||
* | ||
* @return the comment of the model version or null if not set. | ||
*/ | ||
@Nullable | ||
public String getComment() { | ||
return comment; | ||
} | ||
|
||
/** | ||
* Returns the audit information of the model version. | ||
* | ||
* @return the audit information of the model version or null if not set. | ||
*/ | ||
@Nullable | ||
public Audit getAudit() { | ||
return auditInfo; | ||
} | ||
} |
Oops, something went wrong.