Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#6078] feat(core): Support model event to Gravitino server #6129

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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;

/** Event representing the successful drop of a model. */
public class DropModelEvent extends ModelEvent {
private final ModelInfo dropModelInfo;
private final boolean isExists;

/**
* Constructs an instance of {@code DropModelEvent}, capturing essential details about the
* successful drop of a model.
*
* @param user The username of the individual who initiated the model drop operation.
* @param identifier The unique identifier of the model that was dropped.
* @param dropModelInfo The state of the model post-drop operation.
* @param isExists A boolean flag indicating whether the model existed at the time of the drop
* operation.
*/
public DropModelEvent(
String user, NameIdentifier identifier, ModelInfo dropModelInfo, boolean isExists) {
super(user, identifier);
this.dropModelInfo = dropModelInfo;
this.isExists = isExists;
}

/**
* Retrieves the state of the model post-drop operation.
*
* @return The state of the model post-drop operation.
*/
public ModelInfo DropModelInfo() {
return dropModelInfo;
}

/**
* Retrieves the existence status of the model at the time of the drop operation.
*
* @return A boolean value indicating whether the model existed. {@code true} if the model
* existed, otherwise {@code false}.
*/
public boolean isExists() {
return isExists;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.DROP_MODEL;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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 that is generated after a model version is successfully dropped from the
* model.
*/
public class DropModelVersionEvent extends ModelEvent {

private final ModelInfo dropModelVersionInfo;
private final boolean isExists;

/**
* Constructs a new {@code DropModelVersionEvent} instance, encapsulating information about the
* outcome of a model version drop operation.
*
* @param user The user who initiated the drop model version operation.
* @param identifier The identifier of the model that was attempted to be dropped a version.
* @param isExists A boolean flag indicating whether the model version existed at the time of the
* drop operation.
*/
public DropModelVersionEvent(
String user, NameIdentifier identifier, ModelInfo dropModelVersionInfo, boolean isExists) {
super(user, identifier);
this.dropModelVersionInfo = dropModelVersionInfo;
this.isExists = isExists;
}

/**
* Retrieves the state of the model after the drop version operation.
*
* @return The state of the model after the drop version operation.
*/
public ModelInfo DropModelVersionInfo() {
return dropModelVersionInfo;
}

/**
* Retrieves the existence status of the model version at the time of the drop operation.
*
* @return A boolean value indicating whether the model version existed. {@code true} if the model
* version existed, otherwise {@code false}.
*/
public boolean isExists() {
return isExists;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.DROP_MODEL_VERSION;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 of a model. */
public class GetModelEvent extends ModelEvent {
private final ModelInfo modelInfo;

/**
* Constructs an instance of {@code GetModelEvent}, capturing essential details about the
* successful getting of a model.
*
* @param user The username of the individual who initiated the model get.
* @param identifier The unique identifier of the model that was get.
* @param modelInfo The state of the model post-get.
*/
public GetModelEvent(String user, NameIdentifier identifier, ModelInfo modelInfo) {
super(user, identifier);
this.modelInfo = modelInfo;
}

/**
* Retrieves the state of the model as it was made available to the user after successful getting.
*
* @return A {@link ModelInfo} instance encapsulating the details of the model as get.
*/
public ModelInfo getModelInfo() {
return modelInfo;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.GET_MODEL;
}
}
Original file line number Diff line number Diff line change
@@ -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);
this.getModelVersionInfo = getModelVersionInfo;
}

/**
* Retrieves the state of the model as it was made available to the user after successful getting
* the version.
*
* @return A {@link ModelInfo} instance encapsulating the details of the model version.
*/
public ModelInfo getModelVersionInfo() {
return getModelVersionInfo;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.GET_MODEL_VERSION;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 linking of a model version. */
public class LinkModelVersionEvent extends ModelEvent {
private ModelInfo linkModelVersionInfo;

/**
* Constructs an instance of {@code LinkModelVersionEvent}, capturing essential details about the
* successful linking of a model version.
*
* @param user The username of the individual who initiated the model version linking.
* @param identifier The unique identifier of the model that was linked.
* @param linkModelVersionInfo The final state of the model after linking.
*/
public LinkModelVersionEvent(
String user, NameIdentifier identifier, ModelInfo linkModelVersionInfo) {
super(user, identifier);
this.linkModelVersionInfo = linkModelVersionInfo;
}

/**
* Retrieves the final state of the model, as it was returned to the user after successful link a
* model version.
*
* @return A {@link ModelInfo} instance encapsulating the comprehensive details of the newly model
* version.
*/
public ModelInfo linkModelVersionInfo() {
return linkModelVersionInfo;
}

/**
* Returns the type of operation.
*
* @return the operation type.
*/
@Override
public OperationType operationType() {
return OperationType.LINK_MODEL_VERSION;
}
}
Loading
Loading