View Javadoc
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      @Override
34      TransmissionProcessContext getJobProcessContext();
35      
36      /**
37       * Get inventory tasks.
38       *
39       * @return inventory tasks
40       */
41      Collection<PipelineTask> getInventoryTasks();
42      
43      /**
44       * Get incremental tasks.
45       *
46       * @return incremental tasks
47       */
48      Collection<PipelineTask> getIncrementalTasks();
49      
50      /**
51       * Get init progress.
52       *
53       * @return init progress
54       */
55      TransmissionJobItemProgress getInitProgress();
56      
57      /**
58       * Get source meta data loader.
59       *
60       * @return source meta data loader
61       */
62      PipelineTableMetaDataLoader getSourceMetaDataLoader();
63      
64      /**
65       * Get sink.
66       *
67       * @return sink
68       */
69      PipelineSink getSink();
70      
71      /**
72       * Get processed record count.
73       *
74       * @return processed record count.
75       */
76      long getProcessedRecordsCount();
77      
78      /**
79       * Update inventory records count.
80       *
81       * @param recordsCount records count
82       */
83      void updateInventoryRecordsCount(long recordsCount);
84      
85      /**
86       * Get inventory records count.
87       *
88       * @return inventory records count
89       */
90      long getInventoryRecordsCount();
91      
92      @Override
93      default TransmissionJobItemProgress toProgress() {
94          return new TransmissionJobItemProgress(this);
95      }
96  }