Commit b50fb4c
Cosmos: Cut over replace_item, upsert_item, delete_item to driver (#4128)
Routes the remaining item-level operations (`replace_item`,
`upsert_item`, `delete_item`) through the `CosmosDriver`, completing the
item operation cutover from the legacy gateway pipeline.
### Driver
- **`CosmosOperation::upsert_item`** now takes `(ContainerReference,
PartitionKey)` instead of `ItemReference`. Upsert is a `POST` to the
collection feed (same as create), not a `PUT` to a document URL.
### SDK
- **`replace_item`**, **`upsert_item`**, **`delete_item`** in
`ContainerClient` follow the same pattern as `create_item`/`read_item`:
build `CosmosOperation` → wire session token/precondition →
`driver.execute_operation()` → bridge response.
### Cleanup
- Removed `ItemWriteOptions::apply_headers()` and
`apply_precondition_headers()` — dead code now that all item writes use
the driver.
- Removed associated unit tests for the removed shims.
### Updated state
| Method | Pipeline |
|---|---|
| `read_item` | Driver |
| `create_item` | Driver |
| `replace_item` | **Driver** ← |
| `upsert_item` | **Driver** ← |
| `delete_item` | **Driver** ← |
| `query_items` | Gateway |
| Database/Container CRUD | Gateway |
| Batch | Gateway |
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `test.documents.azure.com`
> - Triggering command:
`/home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/target/debug/deps/azure_data_cosmos-6ba76bd8313db34b
/home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/target/debug/deps/azure_data_cosmos-6ba76bd8313db34b
/home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/target/debug/build/azure_core_test-3ead228e4bac545f/build_script_build-3ead228e4bac545f.28rxmzcc53ieso0vhgnjhp0mb.1g0umtu.rcgu.o
-Wl,--as-needed -Wl,-Bstatic get/debug/deps/rustcVORl3H/list
/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libpanic_unwind-e462f106b2b26a06.rlib
/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libobject-926daa94a00ee327.rlib
ORl3H/symbols.o
core_test_macros-a1ab7b6aba03e8ee.00uyiyx5pyx2v1ngfia649863.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.0wxt1muwk7ybp3n7mh0wllbni.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.10a2tbvi9x7z0h5lmbonpdh71.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.16kd4stujzqt4xf2jl2sbtd59.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.1kccwp8eolfs8k1p8t95mpyuj.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.1lmiqx49m2x5aacy6jphmlzgy.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.1zbl7otmqptz39v95knjdsqes.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.2f42o1vbvljajd8rp0o10wval.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.2zwx85bqwtramffcrv2xdiq6i.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.31h1vvrpiuwu05d0sfhyv10f4.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.34eawspeaufijc3hxiybm1m5s.1iuy4et.rcgu.o
core_test_macros-a1ab7b6aba03e8ee.3oxva6e4m60m4raphd0wdn5rb.1iuy4et.rcgu.o`
(dns block)
> - Triggering command:
`/home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/target/debug/deps/azure_data_cosmos-6ba76bd8313db34b
/home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/target/debug/deps/azure_data_cosmos-6ba76bd8313db34b
_data_cosmos-ef5244a14879f580/build_script_build-ef5244a14879f580.5hz7v9l3n3w76s28d4��
_data_cosmos-ef5244a14879f580/build_script_build-ef5244a14879f580.b3xwjkkkf035nfaknghx3bnrq.1v2nf23.rcgu.o
_data_cosmos-ef5244a14879f580/build_script_build-ef5244a14879f580.c2fzye5iqbx61t8txhcw5znvn.1v2nf23.rcgu.o
_data_cosmos-ef5244a14879f580/build_script_build-ef5244a14879f580.d6uyvyxfwkk1tmp94qt99wief.1v2nf23.rcgu.o
rqab2.rcgu.o rqab2.rcgu.o
64-REDACTED-linux-gnu/lib/libstd-46d936097e8c5b85.rlib
64-REDACTED-linux-gnu/lib/libpanic_unwind-e462f106b2b26a06.rlib
64-REDACTED-linux-gnu/lib/libobject-926daa94a00ee327.rlib
64-REDACTED-linux-gnu/lib/libmemchr-48d5b0db80402653.rlib
64-REDACTED-linux-gnu/lib/libaddr2line-3367f26bd486b29d.rlib 64-u��
64-REDACTED-linux-gnu/lib/libcfg_if-a5addfdc94c3bad3.rlib
64-REDACTED-linux-gnu/lib/librustc_demangle-789fb9c0cb1c7158.rlib
4et.rcgu.o 4et.rcgu.o 4et.rcgu.o 4et.rcgu.o 4et.rcgu.o` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/Azure/azure-sdk-for-rust/settings/copilot/coding_agent)
(admins only)
>
> </details>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: simorenoh <30335873+simorenoh@users.noreply.github.com>1 parent ab3ca55 commit b50fb4c
16 files changed
Lines changed: 532 additions & 426 deletions
File tree
- sdk/cosmos
- azure_data_cosmos_driver/src
- driver
- pipeline
- routing
- models
- options
- azure_data_cosmos
- src
- clients
- options
- tests
- emulator_tests
- framework
- multi_write_tests
Lines changed: 92 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
322 | 325 | | |
323 | 326 | | |
324 | 327 | | |
325 | | - | |
| 328 | + | |
326 | 329 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 330 | + | |
335 | 331 | | |
336 | 332 | | |
337 | 333 | | |
| |||
417 | 413 | | |
418 | 414 | | |
419 | 415 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
| 416 | + | |
| 417 | + | |
429 | 418 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
434 | 441 | | |
435 | 442 | | |
436 | 443 | | |
| |||
506 | 513 | | |
507 | 514 | | |
508 | 515 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
518 | 519 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
524 | 536 | | |
525 | 537 | | |
526 | 538 | | |
| |||
567 | 579 | | |
568 | 580 | | |
569 | 581 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
| 582 | + | |
| 583 | + | |
579 | 584 | | |
580 | 585 | | |
581 | 586 | | |
| |||
616 | 621 | | |
617 | 622 | | |
618 | 623 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
| 624 | + | |
627 | 625 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
632 | 648 | | |
633 | 649 | | |
634 | 650 | | |
| |||
906 | 922 | | |
907 | 923 | | |
908 | 924 | | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
909 | 943 | | |
910 | 944 | | |
911 | 945 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
446 | 450 | | |
447 | | - | |
| 451 | + | |
448 | 452 | | |
449 | 453 | | |
450 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 295 | + | |
299 | 296 | | |
300 | 297 | | |
301 | 298 | | |
| |||
402 | 399 | | |
403 | 400 | | |
404 | 401 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | 402 | | |
459 | 403 | | |
460 | 404 | | |
| |||
0 commit comments