1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.data.pipeline.core.consistencycheck.table.calculator;
19
20 import lombok.Getter;
21 import lombok.RequiredArgsConstructor;
22 import org.apache.shardingsphere.infra.metadata.caseinsensitive.CaseInsensitiveQualifiedTable;
23 import org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineColumnMetaData;
24 import org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceWrapper;
25 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
26
27 import java.util.List;
28 import java.util.concurrent.atomic.AtomicReference;
29
30
31
32
33 @RequiredArgsConstructor
34 @Getter
35 public final class SingleTableInventoryCalculateParameter {
36
37
38
39
40
41 private final PipelineDataSourceWrapper dataSource;
42
43 private final CaseInsensitiveQualifiedTable table;
44
45 private final List<String> columnNames;
46
47
48
49
50
51 private final List<PipelineColumnMetaData> uniqueKeys;
52
53 private final Object tableCheckPosition;
54
55 private final AtomicReference<AutoCloseable> calculationContext = new AtomicReference<>();
56
57
58
59
60
61
62 public DatabaseType getDatabaseType() {
63 return dataSource.getDatabaseType();
64 }
65
66
67
68
69
70
71 public String getSchemaName() {
72 return table.getSchemaName().toString();
73 }
74
75
76
77
78
79
80 public String getLogicTableName() {
81 return table.getTableName().toString();
82 }
83
84
85
86
87
88
89 public PipelineColumnMetaData getFirstUniqueKey() {
90 return uniqueKeys.get(0);
91 }
92
93
94
95
96
97
98 public AutoCloseable getCalculationContext() {
99 return calculationContext.get();
100 }
101
102
103
104
105
106
107 public void setCalculationContext(final AutoCloseable calculationContext) {
108 this.calculationContext.set(calculationContext);
109 }
110 }