forked from apache/pulsar
-
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.
Refactor intercept interface (apache#12)
* refactoring intercept interface * cleaning up * fix bug
- Loading branch information
Showing
20 changed files
with
1,359 additions
and
222 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...r-common/src/main/java/org/apache/pulsar/broker/intercept/FunctionsInterceptProvider.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,23 @@ | ||
package org.apache.pulsar.broker.intercept; | ||
|
||
import org.apache.pulsar.common.functions.FunctionConfig; | ||
import org.apache.pulsar.common.io.SinkConfig; | ||
import org.apache.pulsar.common.io.SourceConfig; | ||
|
||
public interface FunctionsInterceptProvider { | ||
/** | ||
* Intercept call for create function | ||
* | ||
* @param functionConfig function config of the function to be created | ||
* @param clientRole the role used to create function | ||
*/ | ||
default void createFunction(FunctionConfig functionConfig, String clientRole) throws InterceptException {} | ||
|
||
/** | ||
* Intercept call for update function | ||
* @param functionConfig function config of the function to be updated | ||
* @param existingFunctionConfig | ||
* @param clientRole the role used to update function | ||
*/ | ||
default void updateFunction(FunctionConfig functionConfig, FunctionConfig existingFunctionConfig, String clientRole) throws InterceptException {} | ||
} |
34 changes: 34 additions & 0 deletions
34
...er-common/src/main/java/org/apache/pulsar/broker/intercept/FunctionsInterceptService.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,34 @@ | ||
package org.apache.pulsar.broker.intercept; | ||
|
||
import org.apache.pulsar.common.functions.FunctionConfig; | ||
|
||
public class FunctionsInterceptService { | ||
|
||
private final FunctionsInterceptProvider provider; | ||
|
||
public FunctionsInterceptService(FunctionsInterceptProvider functionsInterceptProvider) { | ||
this.provider = functionsInterceptProvider; | ||
} | ||
|
||
/** | ||
* Intercept call for create function | ||
* | ||
* @param functionConfig function config of the function to be created | ||
* @param clientRole the role used to create function | ||
*/ | ||
public void createFunction(FunctionConfig functionConfig, String clientRole) throws InterceptException { | ||
provider.createFunction(functionConfig, clientRole); | ||
} | ||
|
||
/** | ||
* Intercept call for update source | ||
* | ||
* @param updates updates to this function's function config | ||
* @param existingFunctionConfig the existing function config | ||
* @param clientRole the role used to update function | ||
*/ | ||
public void updateFunction(FunctionConfig updates, FunctionConfig existingFunctionConfig, String clientRole) throws InterceptException { | ||
provider.updateFunction(updates, existingFunctionConfig, clientRole); | ||
} | ||
|
||
} |
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
Oops, something went wrong.