Commit 86658ba
authored
feat: ClientContext and secure parameters support (#4316)
* feat: Add ClientContext to Options and propagate to RPCs
This change adds support for ClientContext in Options and ensures it is
propagated to ExecuteSql, Read, Commit, and BeginTransaction requests.
It aligns with go/spanner-client-scoped-session-state design.
- Added RequestOptions.ClientContext to Options.
- Refactored request option building to Options.toRequestOptionsProto.
- Updated AbstractReadContext, TransactionRunnerImpl, and SessionImpl to use the shared logic.
- Added tests.
* feat: Add ClientContext support to Connection API
This change adds support for setting and propagating ClientContext in the
Spanner Connection API. ClientContext allows propagating client-scoped
session state (e.g., secure parameters) to Spanner RPCs.
- Added setClientContext/getClientContext to Connection interface and implementation.
- Implemented state propagation from Connection to UnitOfWork and its implementations (ReadWriteTransaction, SingleUseTransaction).
- Fixed accidental import removal in OptionsTest.java.
- Fixed TransactionRunnerImplTest to correctly verify ClientContext propagation.
- Added ClientContextMockServerTest for end-to-end verification.
* Address code-review comments1 parent e8bc9ec commit 86658ba
File tree
17 files changed
+701
-25
lines changed- java-spanner/google-cloud-spanner/src
- main/java/com/google/cloud/spanner
- connection
- test/java/com/google/cloud/spanner
- connection
17 files changed
+701
-25
lines changedLines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
707 | 705 | | |
708 | 706 | | |
709 | 707 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
268 | 300 | | |
269 | 301 | | |
270 | 302 | | |
| |||
462 | 494 | | |
463 | 495 | | |
464 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
465 | 511 | | |
466 | 512 | | |
467 | 513 | | |
| |||
574 | 620 | | |
575 | 621 | | |
576 | 622 | | |
| 623 | + | |
577 | 624 | | |
578 | 625 | | |
579 | 626 | | |
| |||
666 | 713 | | |
667 | 714 | | |
668 | 715 | | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
669 | 724 | | |
670 | 725 | | |
671 | 726 | | |
| |||
777 | 832 | | |
778 | 833 | | |
779 | 834 | | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
780 | 838 | | |
781 | 839 | | |
782 | 840 | | |
| |||
850 | 908 | | |
851 | 909 | | |
852 | 910 | | |
| 911 | + | |
853 | 912 | | |
854 | 913 | | |
855 | 914 | | |
| |||
894 | 953 | | |
895 | 954 | | |
896 | 955 | | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
897 | 959 | | |
898 | 960 | | |
899 | 961 | | |
| |||
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
486 | 489 | | |
487 | 490 | | |
488 | 491 | | |
489 | | - | |
490 | | - | |
491 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
492 | 508 | | |
493 | 509 | | |
494 | 510 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| 264 | + | |
263 | 265 | | |
264 | 266 | | |
265 | 267 | | |
| |||
927 | 929 | | |
928 | 930 | | |
929 | 931 | | |
| 932 | + | |
930 | 933 | | |
931 | 934 | | |
932 | 935 | | |
933 | 936 | | |
934 | 937 | | |
935 | 938 | | |
936 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
937 | 945 | | |
938 | 946 | | |
939 | 947 | | |
| |||
1161 | 1169 | | |
1162 | 1170 | | |
1163 | 1171 | | |
| 1172 | + | |
1164 | 1173 | | |
1165 | 1174 | | |
1166 | 1175 | | |
| |||
1264 | 1273 | | |
1265 | 1274 | | |
1266 | 1275 | | |
| 1276 | + | |
1267 | 1277 | | |
1268 | 1278 | | |
1269 | 1279 | | |
| |||
2016 | 2026 | | |
2017 | 2027 | | |
2018 | 2028 | | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
2019 | 2035 | | |
2020 | 2036 | | |
2021 | 2037 | | |
| |||
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
476 | 470 | | |
477 | 471 | | |
478 | 472 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| 189 | + | |
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
452 | 471 | | |
453 | 472 | | |
454 | 473 | | |
| |||
0 commit comments