-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? 1. add corresponding PartitionPreEvent 2. generate pre-event in PartitionEventDispatcher 3. add test in TestPartitionEvent 4. add document in gravitino-server-config.md ### Why are the changes needed? Fix: #5550 ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? UT
- Loading branch information
Showing
10 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
core/src/main/java/org/apache/gravitino/listener/api/event/AddPartitionPreEvent.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,57 @@ | ||
/* | ||
* 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.TableInfo; | ||
import org.apache.gravitino.listener.api.info.partitions.PartitionInfo; | ||
|
||
/** Represents an event triggered before creating a partition. */ | ||
@DeveloperApi | ||
public class AddPartitionPreEvent extends PartitionPreEvent { | ||
|
||
private final PartitionInfo createPartitionRequest; | ||
|
||
public AddPartitionPreEvent( | ||
String user, NameIdentifier identifier, PartitionInfo createPartitionRequest) { | ||
super(user, identifier); | ||
this.createPartitionRequest = createPartitionRequest; | ||
} | ||
|
||
/** | ||
* Retrieves the create partition request. | ||
* | ||
* @return A {@link TableInfo} instance encapsulating the comprehensive details of create | ||
* partition request. | ||
*/ | ||
public PartitionInfo createdPartitionRequest() { | ||
return createPartitionRequest; | ||
} | ||
|
||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.ADD_PARTITION; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
core/src/main/java/org/apache/gravitino/listener/api/event/DropPartitionPreEvent.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,47 @@ | ||
/* | ||
* 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 triggered before dropping a partition. */ | ||
@DeveloperApi | ||
public class DropPartitionPreEvent extends PartitionPreEvent { | ||
private final String partitionName; | ||
|
||
public DropPartitionPreEvent(String user, NameIdentifier identifier, String partitionName) { | ||
super(user, identifier); | ||
this.partitionName = partitionName; | ||
} | ||
|
||
public String partitionName() { | ||
return partitionName; | ||
} | ||
|
||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.DROP_PARTITION; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
core/src/main/java/org/apache/gravitino/listener/api/event/GetPartitionPreEvent.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,48 @@ | ||
/* | ||
* 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 triggered before getting a partition. */ | ||
@DeveloperApi | ||
public class GetPartitionPreEvent extends PartitionPreEvent { | ||
|
||
private final String partitionName; | ||
|
||
public GetPartitionPreEvent(String user, NameIdentifier identifier, String partitionName) { | ||
super(user, identifier); | ||
this.partitionName = partitionName; | ||
} | ||
|
||
public String partitionName() { | ||
return partitionName; | ||
} | ||
|
||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.LOAD_PARTITION; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
core/src/main/java/org/apache/gravitino/listener/api/event/ListPartitionNamesPreEvent.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,41 @@ | ||
/* | ||
* 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 triggered before listing of partition name within a namespace. */ | ||
@DeveloperApi | ||
public class ListPartitionNamesPreEvent extends PartitionPreEvent { | ||
|
||
public ListPartitionNamesPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
|
||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.LIST_PARTITION_NAMES; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/apache/gravitino/listener/api/event/ListPartitionPreEvent.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,40 @@ | ||
/* | ||
* 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 triggered before listing of partition within a namespace. */ | ||
@DeveloperApi | ||
public class ListPartitionPreEvent extends PartitionPreEvent { | ||
|
||
public ListPartitionPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.LIST_PARTITION; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
core/src/main/java/org/apache/gravitino/listener/api/event/PartitionPreEvent.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,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 a pre-event for partition operations. */ | ||
@DeveloperApi | ||
public abstract class PartitionPreEvent extends PreEvent { | ||
|
||
protected PartitionPreEvent(String user, NameIdentifier identifier) { | ||
super(user, identifier); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
core/src/main/java/org/apache/gravitino/listener/api/event/PurgePartitionPreEvent.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,47 @@ | ||
/* | ||
* 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 triggered before purging a partition. */ | ||
@DeveloperApi | ||
public class PurgePartitionPreEvent extends PartitionPreEvent { | ||
|
||
private final String partitionName; | ||
|
||
public PurgePartitionPreEvent(String user, NameIdentifier identifier, String partitionName) { | ||
super(user, identifier); | ||
this.partitionName = partitionName; | ||
} | ||
|
||
public String partitionName() { | ||
return partitionName; | ||
} | ||
/** | ||
* Returns the type of operation. | ||
* | ||
* @return the operation type. | ||
*/ | ||
@Override | ||
public OperationType operationType() { | ||
return OperationType.PURGE_PARTITION; | ||
} | ||
} |
Oops, something went wrong.