Commit 270feb0
Aditya Bharadwaj
Refactor: Decouple Datastream template from source engines (PR 2)
Introduce a pluggable ISourceConnector interface to encapsulate all source-specific
logic for MySQL, PostgreSQL, and Oracle databases within the datastream-to-spanner
template.
This replaces inline source-specific logic with a clean, decoupled design:
- Created ISourceConnector interface.
- Created MySqlSourceConnector, PostgresqlSourceConnector, and OracleSourceConnector implementing the interface.
- Refactored SourceConnectorRegistry to manually register and manage these connectors (no AutoService/SPI dependency).
- Updated SpannerTransactionWriterDoFn and ShadowTableCreator to interact with sources purely via the ISourceConnector interface.
- Deleted obsolete ChangeEventContextFactory and ChangeEventSequenceFactory classes, delegating context and sequence creation to the connectors.
- Kept all source-specific constants in DatastreamConstants (like in main) to preserve compatibility.
- Removed auto-service dependency from pom.xml.
- All changes are strictly restricted to the datastream-to-spanner template.
TAG=agy
CONV=b7fec87d-3652-43db-a0d1-64773a0544151 parent 1d67a0c commit 270feb0
30 files changed
Lines changed: 1384 additions & 1197 deletions
File tree
- v2/datastream-to-spanner
- src
- main/java/com/google/cloud/teleport/v2/templates
- datastream
- source
- mysql
- oracle
- postgresql
- spanner
- test
- java/com/google/cloud/teleport/v2/templates
- datastream
- source
- mysql
- oracle
- postgresql
- resources/DataStreamToSpannerIT
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
597 | | - | |
| 597 | + | |
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
| |||
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
629 | 628 | | |
630 | | - | |
631 | | - | |
632 | 629 | | |
633 | 630 | | |
634 | 631 | | |
| |||
Lines changed: 43 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| 222 | + | |
219 | 223 | | |
220 | 224 | | |
221 | 225 | | |
| |||
256 | 260 | | |
257 | 261 | | |
258 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
259 | 276 | | |
260 | 277 | | |
261 | 278 | | |
| |||
267 | 284 | | |
268 | 285 | | |
269 | 286 | | |
270 | | - | |
271 | | - | |
| 287 | + | |
| 288 | + | |
272 | 289 | | |
273 | 290 | | |
274 | 291 | | |
275 | | - | |
276 | | - | |
| 292 | + | |
277 | 293 | | |
278 | 294 | | |
279 | 295 | | |
| |||
395 | 411 | | |
396 | 412 | | |
397 | 413 | | |
398 | | - | |
399 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
400 | 417 | | |
401 | 418 | | |
402 | 419 | | |
| |||
463 | 480 | | |
464 | 481 | | |
465 | 482 | | |
466 | | - | |
467 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
468 | 489 | | |
469 | 490 | | |
470 | 491 | | |
| |||
493 | 514 | | |
494 | 515 | | |
495 | 516 | | |
496 | | - | |
| 517 | + | |
497 | 518 | | |
498 | 519 | | |
499 | 520 | | |
| |||
577 | 598 | | |
578 | 599 | | |
579 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
580 | 612 | | |
581 | 613 | | |
582 | 614 | | |
| |||
Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 0 additions & 89 deletions
This file was deleted.
0 commit comments