1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog;
19
20 import lombok.Getter;
21 import lombok.RequiredArgsConstructor;
22 import lombok.Setter;
23 import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.MySQLBinlogTableMapEventPacket;
24 import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef;
25
26 import java.util.List;
27 import java.util.Map;
28
29
30
31
32 @Getter
33 @RequiredArgsConstructor
34 public final class BinlogContext {
35
36 @Setter
37 private volatile String fileName;
38
39 private final int checksumLength;
40
41 private final Map<Long, MySQLBinlogTableMapEventPacket> tableMap;
42
43
44
45
46
47
48
49 public void putTableMapEvent(final long tableId, final MySQLBinlogTableMapEventPacket tableMapEventPacket) {
50 tableMap.put(tableId, tableMapEventPacket);
51 }
52
53
54
55
56
57
58
59 public MySQLBinlogTableMapEventPacket getTableMapEvent(final long tableId) {
60 return tableMap.get(tableId);
61 }
62
63
64
65
66
67
68
69 public String getTableName(final long tableId) {
70 return tableMap.get(tableId).getTableName();
71 }
72
73
74
75
76
77
78
79 public String getDatabaseName(final long tableId) {
80 return tableMap.get(tableId).getSchemaName();
81 }
82
83
84
85
86
87
88
89 public List<MySQLBinlogColumnDef> getColumnDefs(final long tableId) {
90 return tableMap.get(tableId).getColumnDefs();
91 }
92 }