FANNG1 commented on code in PR #5591: URL: https://github.com/apache/gravitino/pull/5591#discussion_r1844959500
########## core/src/main/java/org/apache/gravitino/listener/api/event/CreateCatalogPreEvent.java: ########## @@ -0,0 +1,55 @@ +/* + * 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.annotation.DeveloperApi; +import org.apache.gravitino.listener.api.info.CatalogInfo; + +/** Represents an event triggered before creating a catalog. */ +@DeveloperApi +public class CreateCatalogPreEvent extends CatalogPreEvent { + private final CatalogInfo createdCatalogInfo; + + /** + * Constructs an instance of {@code CreateCatalogEvent}, capturing essential details about the + * successful creation of a catalog. + * + * @param user The username of the individual who initiated the catalog creation. + * @param identifier The unique identifier of the catalog that was created. + * @param createdCatalogInfo The final state of the catalog post-creation. + */ + public CreateCatalogPreEvent( + String user, NameIdentifier identifier, CatalogInfo createdCatalogInfo) { Review Comment: createdCatalogInfo -> createCatalogRequest? ########## docs/gravitino-server-config.md: ########## @@ -134,6 +134,7 @@ Gravitino triggers a pre-event before the operation, a post-event after the comp | Iceberg REST server table operation | `IcebergCreateTablePreEvent`, `IcebergUpdateTablePreEvent`, `IcebergDropTablePreEvent`, `IcebergLoadTablePreEvent`, `IcebergListTablePreEvent`, `IcebergTableExistsPreEvent`, `IcebergRenameTablePreEvent` | 0.7.0-incubating | | Gravitino server table operation | `CreateTablePreEvent`, `AlterTablePreEvent`, `DropTablePreEvent`, `PurgeTablePreEvent`, `LoadTablePreEvent`, `ListTablePreEvent` | 0.8.0-incubating | | Gravitino server schema operation | `CreareSchemaPreEvent`, `AlterSchemaPreEvent`, `DropSchemaPreEvent`, `LoadSchemaPreEvent`, `ListSchemaPreEvent` | 0.8.0-incubating | +| Gravitino server catalog operation | `CreareCatalogPreEvent`, `AlterCatalogPreEvent`, `DropCatalogPreEvent`, `LoadCatalogPreEvent`, `ListCatalogPreEvent` | | Review Comment: CreareCatalogPreEvent -> CreateCatalogPreEvent? ########## core/src/main/java/org/apache/gravitino/listener/api/event/DropCatalogPreEvent.java: ########## @@ -0,0 +1,31 @@ +/* + * 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.annotation.DeveloperApi; + +/** Represents an event that is generated before a catalog is successfully dropped. */ Review Comment: remove `successfully`? ########## core/src/main/java/org/apache/gravitino/listener/api/event/AlterCatalogPreEvent.java: ########## @@ -0,0 +1,56 @@ +/* + * 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.CatalogChange; +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.annotation.DeveloperApi; + +/** Represents an event triggered before altering a catalog. */ +@DeveloperApi +public final class AlterCatalogPreEvent extends CatalogPreEvent { + private final CatalogChange[] catalogChanges; + + /** + * Constructs an instance of {@code AlterCatalogEvent}, encapsulating the key details about the + * successful alteration of a catalog. + * + * @param user The username of the individual responsible for initiating the catalog alteration. + * @param identifier The unique identifier of the altered catalog, serving as a clear reference + * point for the catalog in question. + * @param catalogChanges An array of {@link CatalogChange} objects representing the specific + * changes applied to the catalog during the alteration process. + */ + public AlterCatalogPreEvent( + String user, NameIdentifier identifier, CatalogChange[] catalogChanges) { + super(user, identifier); + this.catalogChanges = catalogChanges.clone(); Review Comment: remove clone here? no need to clone in pre event -- 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]
