forked from apache/shardingsphere
-
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.
Add PipelineJobExecutor (apache#32762)
* Add PipelineJobExecutor * Add PipelineJobExecutor * Add PipelineJobExecutor * Add PipelineJobExecutor
- Loading branch information
Showing
7 changed files
with
277 additions
and
121 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
65 changes: 65 additions & 0 deletions
65
...hardingsphere/data/pipeline/core/job/executor/DistributedPipelineJobExecutorCallback.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,65 @@ | ||
/* | ||
* 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.shardingsphere.data.pipeline.core.job.executor; | ||
|
||
import org.apache.shardingsphere.data.pipeline.core.context.PipelineJobItemContext; | ||
import org.apache.shardingsphere.data.pipeline.core.context.TransmissionProcessContext; | ||
import org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceManager; | ||
import org.apache.shardingsphere.data.pipeline.core.job.config.PipelineJobConfiguration; | ||
import org.apache.shardingsphere.data.pipeline.core.job.progress.PipelineJobItemProgress; | ||
import org.apache.shardingsphere.data.pipeline.core.task.runner.PipelineTasksRunner; | ||
|
||
import java.sql.SQLException; | ||
|
||
/** | ||
* Distributed pipeline job executor callback. | ||
* | ||
* @param <T> type of pipeline job configuration | ||
* @param <I> type of pipeline job item context | ||
* @param <P> type of pipeline job item progress | ||
*/ | ||
public interface DistributedPipelineJobExecutorCallback<T extends PipelineJobConfiguration, I extends PipelineJobItemContext, P extends PipelineJobItemProgress> { | ||
|
||
/** | ||
* Build job item context. | ||
* | ||
* @param jobConfig job configuration | ||
* @param shardingItem sharding item | ||
* @param jobItemProgress job item progress | ||
* @param jobProcessContext job process context | ||
* @param dataSourceManager pipeline data source manager | ||
* @return built job item context | ||
*/ | ||
I buildJobItemContext(T jobConfig, int shardingItem, P jobItemProgress, TransmissionProcessContext jobProcessContext, PipelineDataSourceManager dataSourceManager); | ||
|
||
/** | ||
* Build tasks runner. | ||
* | ||
* @param jobItemContext job item context | ||
* @return built tasks runner | ||
*/ | ||
PipelineTasksRunner buildTasksRunner(I jobItemContext); | ||
|
||
/** | ||
* Prepare. | ||
* | ||
* @param jobItemContext job item context | ||
* @throws SQLException SQL exception | ||
*/ | ||
void prepare(I jobItemContext) throws SQLException; | ||
} |
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
52 changes: 52 additions & 0 deletions
52
...ngsphere/data/pipeline/scenario/consistencycheck/ConsistencyCheckJobExecutorCallback.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,52 @@ | ||
/* | ||
* 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.shardingsphere.data.pipeline.scenario.consistencycheck; | ||
|
||
import org.apache.shardingsphere.data.pipeline.core.context.TransmissionProcessContext; | ||
import org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceManager; | ||
import org.apache.shardingsphere.data.pipeline.core.job.JobStatus; | ||
import org.apache.shardingsphere.data.pipeline.core.job.executor.DistributedPipelineJobExecutorCallback; | ||
import org.apache.shardingsphere.data.pipeline.core.job.progress.ConsistencyCheckJobItemProgress; | ||
import org.apache.shardingsphere.data.pipeline.core.task.runner.PipelineTasksRunner; | ||
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.config.ConsistencyCheckJobConfiguration; | ||
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.context.ConsistencyCheckJobItemContext; | ||
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.task.ConsistencyCheckTasksRunner; | ||
|
||
/** | ||
* Consistency check job executor callback. | ||
*/ | ||
public final class ConsistencyCheckJobExecutorCallback | ||
implements | ||
DistributedPipelineJobExecutorCallback<ConsistencyCheckJobConfiguration, ConsistencyCheckJobItemContext, ConsistencyCheckJobItemProgress> { | ||
|
||
@Override | ||
public ConsistencyCheckJobItemContext buildJobItemContext(final ConsistencyCheckJobConfiguration jobConfig, final int shardingItem, | ||
final ConsistencyCheckJobItemProgress jobItemProgress, final TransmissionProcessContext jobProcessContext, | ||
final PipelineDataSourceManager dataSourceManager) { | ||
return new ConsistencyCheckJobItemContext(jobConfig, shardingItem, JobStatus.RUNNING, jobItemProgress); | ||
} | ||
|
||
@Override | ||
public PipelineTasksRunner buildTasksRunner(final ConsistencyCheckJobItemContext jobItemContext) { | ||
return new ConsistencyCheckTasksRunner(jobItemContext); | ||
} | ||
|
||
@Override | ||
public void prepare(final ConsistencyCheckJobItemContext jobItemContext) { | ||
} | ||
} |
Oops, something went wrong.