1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.apache.shardingsphere.data.pipeline.core.context;
19
20 import org.apache.shardingsphere.data.pipeline.core.job.progress.TransmissionJobItemProgress;
21 import org.apache.shardingsphere.data.pipeline.core.job.progress.listener.PipelineJobProgressListener;
22 import org.apache.shardingsphere.data.pipeline.core.metadata.loader.PipelineTableMetaDataLoader;
23 import org.apache.shardingsphere.data.pipeline.core.importer.sink.PipelineSink;
24 import org.apache.shardingsphere.data.pipeline.core.task.PipelineTask;
25
26 import java.util.Collection;
27
28 /**
29 * Transmission job item context.
30 */
31 public interface TransmissionJobItemContext extends PipelineJobItemContext, PipelineJobProgressListener {
32
33 /**
34 * Get inventory tasks.
35 *
36 * @return inventory tasks
37 */
38 Collection<PipelineTask> getInventoryTasks();
39
40 /**
41 * Get incremental tasks.
42 *
43 * @return incremental tasks
44 */
45 Collection<PipelineTask> getIncrementalTasks();
46
47 /**
48 * Get init progress.
49 *
50 * @return init progress
51 */
52 TransmissionJobItemProgress getInitProgress();
53
54 /**
55 * Get source meta data loader.
56 *
57 * @return source meta data loader
58 */
59 PipelineTableMetaDataLoader getSourceMetaDataLoader();
60
61 /**
62 * Get sink.
63 *
64 * @return sink
65 */
66 PipelineSink getSink();
67
68 /**
69 * Get processed record count.
70 *
71 * @return processed record count.
72 */
73 long getProcessedRecordsCount();
74
75 /**
76 * Update inventory records count.
77 *
78 * @param recordsCount records count
79 */
80 void updateInventoryRecordsCount(long recordsCount);
81
82 /**
83 * Get inventory records count.
84 *
85 * @return inventory records count
86 */
87 long getInventoryRecordsCount();
88
89 @Override
90 TransmissionProcessContext getJobProcessContext();
91
92 @Override
93 default TransmissionJobItemProgress toProgress() {
94 return new TransmissionJobItemProgress(this);
95 }
96 }